We know from the question "How did the house elves start serving wizards?" that it is not sure when was house elves enslaved, so we probably don't know the evolution of the rule in the past.
But the rule is pretty strange, right? I mean, why clothes? Why not any gift for example?
I see more options here:
House elves made the rule by themselves in the long past (and the rule is powerful because generations of house elves believe in it) – it is in their heads, that is why Dobby could be freed in the little controversy way, he just persuaded himself (Malfoy didn't want to give him sock, it wasn't even his).
The rule is magically made by the original slave master, the rules are made by him (then the question again is: Why clothes? How does it work exactly? What could be his intention?)
The rule is something from nature, house elves are born with it. That would mean that they were born (or created?) to serve wizards. Which leads to other questions: Was it always like that? Clothes aren't exactly nature invention. Is there any other way to free them (maybe clothes are just subset of possible ways)?
To sum up
How does the rule work? Is it some of these options? Is there another way to free a house elf?