The simple reality is that taxpayers fund a good deal of pharmaceutical R&DAnd how much of the very most expensive clinical trials, and applications to the FDA? Not to mention marketing, so busy doctors actually know of their existence?
Upfront drug discovery is very easy compared to that, as well illustrated by this XKCD cartoon: https://xkcd.com/1217/
drug prices have little to no relationship to their actual cost
Which is Marketing 101. And also demonstrably not true for the particularly expensive ones to produce (I'm thinking in particular of the HIV antiviral with 3 chiral centers).
And while Mylan has certainly been raping a population that depends on Epi-Pens for their lives (including my 2nd oldest nephew ... and speaking of family, it's good to be the daughter of a US Senator), anything liquid is inherently more expensive for a whole bunch of reasons.
And as far as I can tell, there are exactly 4 different ED drugs approved by the FDA in 5 formulations, and what's with the misandry?
and these companies do a very good job of exploiting loopholes to pay as little tax back into the system as possible.
Which is endorsed by no less of a moral authority than the US Supreme Court, and makes them no different that any other well run industry.