You must be very, very important to them that they would be willing to break the law to punish you for leaving. If I were that important to a firm, I would skip applying for a job elsewhere, and immediately negotiate a large raise and much better benefits.