From a business perspective, there are at least four kinds of costs to be considered. From top to bottom, they are:
Facility costs -- the cost of having a plant or facility to make or do anything.
Product costs -- the cost to make a product, including tooling and R&D
Batch costs -- the cost to make a batch of product, including setup and trial runs until the process is controlled
Unit costs -- the cost to make an additional unit of product. This is typically the raw material and production labor
Traditionally, facility and product costs are thought of as fixed, and batch and unit costs are thought of as variable.
To make a drug, companies incur substantial product costs -- the research involved in creating the drug and finding out whether it's useful or not. The company generates no revenue until it can sell some product, or starts to incur unit costs. If it never sells anything, it never makes any revenue.
So, the complaint about drug prices is about the price versus the unit cost, as opposed to the price versus the total cost. Each additional pill or treatment sold should cover its own unit cost and a portion of its batch cost, and any money left over starts to cover the product and facilities costs.
Eventually, enough product has been sold to cover the product costs. At that point, the money that covered the product cost is now pure (or mostly pure) profit.
Should companies be allowed to make a fair profit? Absolutely. Should they be rewarded for investing their money to develop products that may or may not succeed? Yep, as long as the market decides. Should they raise the price to what they think the market will bear? Well, here's the nutter between capitalism (yes) and socialism (no). There are no right answers for this one, just ways of being.
I say let 'em charge what the market will bear. That already happens, with negotiations between insurance companies and providers; the same thing will happen with the drug companies.
And now, I've gotta run, so I'll come back later for any toasty responses