Competitions like that can help. However, funding of basic research that can then lead to big breakthroughs later is also a good idea.
Here's a proposal: stop granting hugely profitable exclusive patents on university research funded by the federal government. Give the government a right to license broadly patents it helped fund and share the proceeds with the discovering professors and students. That way the cost to the pharma companies would be smaller.
Use the government's proceeds from licensing said patent to fund the FDA's evaluation of any drugs based on the research. This further cuts down on the costs to the drug company.
Make it a term in the research's patents that final drug patents based on it must be similarly licensed. Use those proceeds to subsidize Medicare and Medicaid.
Then, the drug research is more widely spread, the benefits and risks of the research are more widely spread, the risks are lower per company, the costs of the drugs are lower to bring to market. The market prices may even follow suit.
Then, tie the research funding to a certain amount of the funds across the country being used for classes of drugs the public really needs but are being underrepresented, like antibiotics.