As long as the thing you promise to do (or refrain from doing) is something that you would otherwise have the legal right to do, it can be an enforceable contract term.
In this case, the buyer promises to refrain from selling their car in the first year--something they otherwise would have a legal right to do.
A contract for murder, on the other hand, would not be enforceable because there is no legal right to commit murder.
Which is a real thing in canon. Bajor's application was put in jeopardy when they briefly reinstated a caste system, which violated Federation equality rules.
Works for me. Here's an Internet Archive version: https://archive.org/details/Science_Fiction_Quarterly_New_Series_v04n05_1956-11_slpn/page/n5/mode/2up?view=theater