For-profit companies actually fund more R&D than public research does (globally the biopharma industry spends $200B+ on R&D a year; NIH budget is $34B; not sure about other countries' public medical research budgets but doubt international public drug R&D approaches $200B tho i could be wrong).

Typically the way it works today is that an academic group, startup or big pharma company will have a "seed" of an idea for a drug. Some of the early drug discovery work happens in academia, some in startups, some at big pharma. But by the time that a potential drug enters preclinical development it is almost always owned by a for-profit company because they have the budget and resources for this work. At this stage fewer than 0.01%-5% of candidate drugs end up working and getting approved by FDA, and it costs tens or hundreds of millions to get a drug approved (and it can cost multiples of that if you include cost of failed drugs). So these companies take a tremendous amount of risk.

These days startups do most of the late stage discovery / early stage development work. They often take the drugs through the riskiest phases of development, generally up to Phase 1/2 or Phase 2 where effectiveness is first tested in humans. Phase 2 failure is the single largest driver of the cost of drug development. Phase 2 failure rates are as high as 60-70%, and it can cost $100M+ to get a drug to Phase 2.

In many cases a startup will try to sell their drug to big pharma after good Phase 2 data. At this point the risk is much lower (drugs have a better than 50% chance of getting approved), but they require significant funding to do the large Phase 3 studies needed for approval and to fund commercialization (can need 9 figures just for Phase 3 work and submission to FDA). So at this point it is a lower risk / lower return bet, but an expensive one, and big pharma companies are structured to take those bets.

However big pharma companies also spend a lot on early stage R&D. From looking at SEC filings, it seems roughly half of big pharma R&D is early stage and half late stage. The problem is that big pharma typically does not do well at early R&D. The return on investment in R&D at big pharma companies is approaching 0%.

Much of the high price of drugs is simply a function of the high risk and high cost of drug development. Very few drugs that pharma invests in actually become profitable drugs. So they try to milk all they can out of the few winners. It isn't the case that pharma's business model is buying fully derisked products from academia and then jacking up the price.

And while at some point publicly funded research could replace for-profit research, the reality today is that if we didnt have for-profit drug research then we would not have new drugs.

in 2017 the FDA approved 49 new drugs. None of those were owned by non-profits at approval (one was owned by a public-private JV). There is not enough non-profit money to take drugs through the development process to FDA approval

And when high prices do exist, in many cases it is because the drugs literally save lives. If you value a QALY at $50K / year (a common estimate), and your drug enables a child to live a full life who otherwise would have died at age 2 due to a rare genetic disease, it doesn't seem absolutely crazy to charge $1M for that drug. The issue to me seems to be more 1) what happens if you pay $1M for a drug and it doesn't work or 2) what if the patient cannot afford to pay $1M upfront for the drug even if it is guaranteed to add 20 healthy years to your life.