Is that sell a car or own a dealership? Because the former would violate the US constitution, while the latter is kinda obnoxious in a free market but legal.
The way I understand it (and IANAL), this all has its origin in contract law - the car makers and the car dealers have agreed contractually to limitations on what car makers can and can't do. The car dealers, realizing that contracts expire and can be changed (and maybe realizing that new car makers haven't also signed on to the cozy relationship), have also managed to get this relationship written into state laws as well.
It varies state to state - the most typical expression of the relationship is sort of like "if you have franchised dealers as a car maker, then you can only sell through franchised dealers". In a few states, a few words were artfully dropped, and it got turned into "you can only sell through franchised dealers" (which is why Tesla doesn't have a retail, and in some cases educational, service, or any other presence in those states).
Many of us believe that if Tesla keeps pushing on those laws, the eventual conclusion of these more extreme variants is that they will be ruled unconstitutional.
A reasonable question for Tesla to ask of itself is whether it wants to spend money on lawyers and lobbyists trying to change these franchise laws that the rest of the auto makers have hung about their necks. If Tesla can sell cars effectively in the US via online web ordering / sales, at least for the next few years, maybe Tesla lets the dealerships and the rest of the car dealers hang with their franchise laws and see how far Tesla can go without spending money or energy on it.
For my own part, I kind of like this point of view. There are enough states with sufficient flexibility in their car sales laws to allow Tesla room to operate.
And yes, the restraint on trade represented by the car dealership / franchise laws is kind of obnoxious in a free market. I totally agree with you on that. There's some reason for the beginning of the laws - the car makers were pretty obnoxious in the early days of the car market and the laws were formulated to protect dealers from the manufacturers. Like any good batch of laws though, they were captured and turned from shields into weapons for insuring market position for car dealers. (that's how I see it anyway)