Part of what happens at a dealership: the manufacturer sets the warranty time for a repair. I'll be the first to tell you reality has nothing to do with warranty time. Take repalcing a radio, for instance. The time to replace is generally 1 to 3 tenths of an hour. There's no additional time allowed to find the problem. Let's take an average .2 repair time; that's 12 minutes. In that time span the tech is expected to: pull the repair order, get the car and pull it inside, diagnose the problem, get the part ordered if not in stock. He doesn't get paid on the first visit if the radio is not in stock.
So when the car comes back for the repair, he has to: pull the repair order, get the car and pull it into the shop, remove and reinstall the radio, test the replacement unit for proper operation, return the old unit to the parts department and complete the paperwork. I won't even get into the manufacturers who require time clock punches for different parts of the repair: diagnosis, repair, quality control. that's six time card punches for a .2 repair. He is also expected to fix the problem for free if it comes back, unless it's a defective part.
If he's got less than half an hour in this, he's lucky. so he is now 18 minutes (or 3 tenths of an hour) behind. Since he has a family to feed, he's got to make it up somewhere.
Don't think the manufacturers aren't aware of this, either. They know EXACTLY what they are doing; shortchanging the techs to protect their warranty bottom line and the cost gets passed on to the other customers.
On the parts side of things, it varies somewhat from manufacturer to manufacturer, but as a general rule things like radios and instrument clusters are supplied as exchange units at no cost to the dealership. This means there's no markup or profit, either. Some mfgs. even do that with major assemblies like engines, etc.
Both the parts and service end of things are expected to turn a profit. Otherwise, the managers and staff get replaced with those who will make a profit. That's the way of the world, folks; it happens in the aftermarket as well.
The only good thing about being in the aftermarket: they can shove the tough no profit work off onto us after doing all the easy high profit parts swapping. I can't count the times someone has shown up at my door with a crappy running car with new plugs/wires/cap/rotor/filters/brake pads/ yada yada and they say 'So and so tried to fix my car and couldn't, he says there's a recall on this kind of thing and you'd fix it for free'. So you paid him $500 to try a bunch of crap and now I'm supposed to fix it for free, huh?