From: Rabbi Moshe Sofer
To: Unknown recipient
The Chasam Sofer clarifies that a worker's right to retract mid-employment is a legal principle (dina), not merely a prohibition, rooted in the concept that Jews are already "sold" to God. He mediates between the Maharam MiRotenburg and Tosfos by identifying the precise distinction between a hired worker and an eved ivri—namely, that the worker's departure is not contingent on monetary payment—and derives a novel prohibition against penalty clauses that would effectively eliminate this distinction. The same three-year hiring restriction applies to communal rabbis, though communities may permissibly stipulate free retraction provided the rabbi does not switch to another community.
Source: Shu"t Chasam Sofer CM §172