Cafe Hayek’s Don Boudreaux has an interesting quote from a 1905 work on English law (“Lectures on the Relation Between Law & Public Opinion in England During the Nineteenth Century,” by Albert Venn Dicey).
Law-making of this sort [i.e., legislation meant to protect certain people from contractual outcomes deemed by the legislature to be undesirable for those people] generally passes through two stages. In the earlier stage the law places upon some kind of contract an interpretation supposed to be specially favourable to one of the parties, but allows them to negative such construction by the express terms of the agreement between them. In the later stage the law forbids the parties to vary, by the terms of their contract, the construction placed upon it by law. The difference between these two stages is well illustrated by the case of a lease made by a landlord to a tenant farmer. As the law originally stood the tenant had no right to compensation for improvements made by him during his tenancy, unless he was entitled thereto by an express term in his lease. This was felt to be a hardship. Parliament, therefore, enacted that it should be an implied term of every lease, unless the contrary were expressly stated therein, that the tenant should receive compensation for improvements. So far there was no interference with the contractual freedom either of the landlord or the tenant, for it was open to the parties by an express term of the lease to exclude the tenant’s right to compensation. It was found, however, that, upon this change in the law, the tenant’s right was habitually excluded by the terms of the lease, and that he did not therefore receive the benefit which the legislature hoped to confer upon him. The next step was for Parliament absolutely to prohibit the bargaining away of his right by the tenant.