Yes, selling for cheap is better than not selling at all, but if the government entities keep being stingy, maybe next time the company won't develop a treatment for a rare disease at all because it's just not worth it...
Which is exactly the problem. And it's even worse than that, because it's a global market with national monopsony buyers. If your country is 4% of the global market, whatever you do isn't going to change the math for the drug company very much and you can ride on the coattails of other countries, so you might as well be as stingy as possible. But then everyone has the same incentive and the net effect is tragedy of the commons.
Or in practice, the US disproportionately funding drug development for the whole world and then people from other countries criticizing them for having higher drug prices.
Which is effectively price controls, because the number of people with the money to pay out of pocket will be low, so the choice is essentially to sell at the regulated price or not at all. And the company would be crazy to choose the latter because the high cost is to pay for R&D, not manufacturing, so they'll never be better off to abandon the market than to take whatever they're offered.
Then you have prices being set by the political system. If the regulators get captured by pharma companies (as would be likely if implemented in the US) they'd overpay when the drug isn't worth it. If not, the regulators would have all the leverage and very little reason not to set prices too low, reducing the incentive for R&D and causing more people to die.