A mechanic's lien is a security interest in the title to property for the benefit of those who have supplied labor or materials that improve the property. The lien exists for both real property and personal property. In the realm of real property, it is called by various names, including, generically, construction lien. The term "lien" comes from a French root, with a meaning similar to link, which is itself ultimately descended from the Latin ligamen, meaning "bond" and ligare, meaning "to bind". Mechanic's liens on property in the United States date from the 18th century.
Mechanic's liens in their modern form were first conceived by Thomas Jefferson, to encourage construction in the new capital city of Washington. They were established by the Maryland General Assembly, of which the city of Washington was then a part. However, it is not likely that Jefferson single-handedly dreamed up the idea.
At the time Jefferson promoted the law, a lien-like privilege already existed in civil law countries like France, the Dutch Republic and Spain, with some laws even tracing their roots to the Roman Empire. And since control of Louisiana had passed between the French and Spaniards, and had largely adopted the French Napoleonic Code, there was a similar privilege concept in that territory.
It seems highly likely that the legislators working on the first U.S. Mechanic Lien laws had knowledge of, and referenced these civil law concepts. Nevertheless, the United States version was original, as it gave builders a more robust right into the land itself (versus just the improvement’s value).
With respect to real property, mechanic's liens are purely statutory devices that exist in every state (although in California, as noted below, they have a constitutional foundation). The reason they exist is a legislative public policy to protect contractors. More specifically, the state legislatures have determined that, due to the economics of the construction business, contractors and subcontractors need greater remedy for non-payment for their work than merely the right to sue on their contracts.