as a unit selling a used car will yield more profit from the immediate sale. Usually they get the seller on the trade in and the buyer on the sale (two profits really).
on a new unit the dealer is usually dealing with someone that thinks 'sticker' is a good deal, even with that $600 'stain protection' package and $250 pinstripe

....so on a deal like that he is making almost 100% on the add on sticker, the difference from MSRP to invoice, the 1-3% holdback he gets based on the MSRP (sometimes invoice and sometimes no holdback, but that is rare)....
Plus if he is a big dealership and sells a lot of cars, there are bonuses awarded and discount tiers to buy more cars at. A small dealershp buying 1 or 2 cars at a time pays invoice, a large shop buying 1000's to stock at their 50 dealerships gets a volume discount....again not all manufacturers offer this.
Moran of Southeast Toyota makes quite a bit more than the average dealership owner...he negotiated with Toyota in the 70's when no one wanted to carry them, he demanded and got an exclusive on the whole SouthEast USA. He is able to relabel Toyota's options and call them a Moran option and up the price. He isn't extremely greedy which is good, but pricing out a Toyota on the 'net is going to be about 1%-2% cheaper than what you will have to pay.
And as mentioned above...once you enter 'their' finance department you are also paying them profit. My last financing of a car they told me with 'my credit' (which was actually good)...I only qualified for a rate 2% above the advertised rate (which was a good rate in a way, but not the best).....they said with rates changing quick I better do it now....I waited and saved 5% APR going with a local bank....