Local taxation. By handing out localized regulated monopolies, States and cities get to claim a chunk of the profits from each sale rather than handing it all off to an out of State manufacturer.
Income tax on commissions, property tax on the real estate for the lots and showrooms, business licenses for operating within the municipality. Really anywhere they can.
If there were less car dealerships, there would need to be more independent mechanics to cover servicing and repairs - so at the end of the day I don't think much would change in terms of state and city income.
These things all apply to every other business, but you don't see the same type of issues with every business. I don't see anything that state & local governments get from the current model above & beyond others.