They cost a ton of money and take forever to create, so the product becomes very expensive, and rights to it are owned by the creating company. The government empowers a body to regulate the flow of new drugs on the market, and once the drug meets regulatory requirements, the government - in many cases - pays on behalf of the patient.
A company is interested in making a profit on their time investment, whereas the government could be content to break even (for the good of their citizens).
If the government instead paid a company to do the R&D, maybe even providing access to approved facilities where the work is to be done, the government could then retain ownership of that product and then create agreements with drug manufacturers to produce those drugs.
This solves a couple of problems, like sole producers of a product arbitrarily increasing prices (it is expensive and time consuming to set up production for a new drug, even if it is off patent), as well as supply issues (I don't think right now the FDA has any rules saying a drug company must be able to supply a certain amount of a drug to get their license to distribute).