Drug companies have a portfolio of compounds they research. Most don’t pay off, so R&D costs make their way into the pricing of those superstar and other drugs that do work. Also, timelines are pretty long.
If supply was not artificially restricted (through patents), then competitors would be able to manufacture the drug, supply would expand, the price would collapse, and the original inventor would not be able to recover their R&D costs.
For the rest of us, that giant increase in revenue is an increase in our healthcare costs.
I think I can spot a flaw in that logic.