Subsidizing doesn't stop the price gouging though, it only distributes the cost and in fact may increase the incentive for price gouging since payment would be nearly guaranteed.
Why not free the intellectual property here instead?
Because without patents and exclusivity, the return on the massive R&D involved doesn't exist. Naturally that removes the incentive for R&D (in the market as it exists today.)
The incentive is that they get to market first as well as the inherent value of the medicine. They could also be paid the cost of R&D or a market price for the initial release of the information rather than a royalty (ransom model).