Anything you come up with could be copied and produced for pennies on the dollars by any number of companies. Of course, the cost to produce most medicines is quite low.
So you have to invest a high fixed cost in R&D, at great risk of failure, and in the end you don't recoup any of that cost.
When patents expire, you'll see many generics come onto the market at reduced costs, and cost to consumer goes down.
Some other system could probably work, but free market R&D would fail without protections to profit from creations. I suspect trying to replace the free market system with some quasi-public one would not produce as many innovations.