Drugs, as a whole, aren't that expensive today compared to other healthcare. They make up 9.8% of US health care expenditure, which is pretty much middle of the pack compared to OECD countries. Hospitals, largely "non profit" (but sometimes massively profitable) make up 35%. But drugs feel more expensive bc copays are typically higher for drugs than for medical care
As it stands today the drug industry spends ~$200B a year to get 20-50 new FDA approved drugs a year. Virtually no fda approved drugs are developed solely by academia. NIH budget is $30-35B and on a steady long term decline. So you'd have a massive taxpayer expense just to build out that r&d function
Then you'd have to build out manufacturing. And some sales and marketing analog -- even if you aren't trying to profit, somebody needs to go out and tell doctors about your new drug and share with them very detailed data about how the drug works, what patients it works for, compared to the competition. Doctors can't stay on top of this themselves -- they are too busy and there's too much info
Then you'd need to build out some administrative function and some way to decide what projects move forward at what stage. This is where publicly funded drug research would probably massively underperform private for profit r&d
If you are making drugs for profit, you have a strong incentive to be efficient with your research. If not you go out of business. The more these decisions are driven by politics rather than profit motive, the less productive r&d is. And r&d cost and productivity is the reason drugs are expensive
There's evidence that startups are 10x more productive at r&d than pharma and it isn't crazy to attribute a lot of that to less politics
As of now something like 30-50% of published academic findings are thought to be false. 30%+ of all NIH money goes to "overhead", i.e. Profit to universities. And yields no fda approved drugs without private company investment