Ammcinnis covered it pretty well!
Your understanding is correct, there are many variables that go into the actual cost. Dealerships that are just giving away cars - high volume - are typically going to have bigger kickbacks/bonuses to pass along to you. I can't speak to other industries (clothing, restaurants, etc), but I don't think I've ever known the "actual" cost of an electronic item, clothing item, or restaurant dish that I've purchased!
In terms of the loss, it's a dealer loss. This isn't unique to a specific dealer either. The vehicles you see on a lot have been bought and paid for by that particular dealer at a set price (which, again, has many factors including kickbacks from volume sales, incentives by region for that month, etc etc), and from the moment they are unloaded off of a truck, it's a ticking time bomb of money loss. If the floor costs (what it costs per vehicle/per day to take up space there) are high enough, and the car sits for long enough, then you reach a point where the dealer has LOST money. Even if they sell it for a value above their initial cost, they've taken a "loss" because it's cost them more to store it there than they had in it for profit to begin with. At that point, they know they have a loser, and will do whatever it takes (typically) to stop the bleeding. I.E., DEEP discounts, free accessories, etc etc.
Something to keep in mind though, even those "losers" are going to help them recoup bonus money at the end of the month if their volume metric has been reached.
Lastly, keep in mind, everyone LOVES to fixate on the price of a car when determining value (or "how good of a deal they received"). There are multiple parts to a deal, including financing rates, your trade, accessories, warranties, gap insurance...plenty of places for us to make money. That's why the high pressure model works so well for a lot of these dealerships. Get you down there for the price, end up making more on the back end of the deal because you've reached a point where you just want to get the hell out of there and are ready to sign just about anything.
The GOOD news, is that there a lot of Dealerships out there who are moving away from this model. It's become much more consumer friendly.
Anywho, sorry for the bouncing around here, I'm actually trying to sell some cars myself today Hopefully that helps a bit!
OH, one more quick thing... the reason the Subaru VIP pricing is, in my opinion, a great deal for people...if you read the fine print, it's a set price (very fair, good savings), set financing (the dealer can't mark it up), and the dealer still gets to make money (they get a set dollar amount back FROM Subaru on the vip deals, because of the fixed pricing).