spot on hippy..plus the dealer has to put the car through their workshop to make sure that it is worthy of a warranty, which costs money. They have to pay for any required repairs, tyres etc and the rental on their property, wages to staff, detailers and the salespersons comission, advertising etc
They will also be financing the money that they pay you for the car, so the longer the car sits in their dealership the more interest they will have to pay.
In the end you would be surprised how little profit the dealership actually makes.
When you look at the whole equation (investment vs return) you would be crazy to open a car dealership today. Most of the successful dealerships have been around for a long time and have large established customer bases.