NPR said it was due to Ford and other auto makers back in the 1920-1930 bullying dealerships. Ford threatened to cancel their business contracts with dealership if the dealerships didn't buy cars that they knew they couldn't sell. During that time, Ford kept their lines running at full capacity even though demand didn't warrant it. The states decided to step in and protect their local dealerships from the megacorp that was Ford and the other manufacturers of that time.
The auto makers of back then dug their own grave with their business practices.
Another argument I've heard is about sales tax. If an auto-maker could sell direct to customers, it could (possibly) be treated as interstate commerce and avoid directly collecting the sales tax. So it's in the state interest to keep dealerships around.