Products are priced in two ways. First, it has to make a profit, or will lead to a profit, otherwise it does not pay to produce. Next, it is priced to the market. If the market is willing to pay the price for the product, the product is well priced.

You can get a car with the basic attributes of a 5er for half the price, similar size, carrying capacity, etc.

Same with jeans. You can spend anywhere from $10 to a couple of hundred dollars for jeans.

So why does BMW charge so much for the 5? Because they can.

Not quite the point. The F10 is also expensive compared to A6 and E class as well, direct competitors.