Unless the entire world adopts this legislature in lock-step, there will still be incentives for ransomware authors to infect systems.
So what if French, Spanish, and American victims are legally prohibited from paying, if there's still money to be made in India, Australia, and Ireland?
Because the marginal cost of vulnerability exploitation is very low, what will end up happening is ransomware distributors will remain in business, and French, Spanish, and American companies will now not be able to recover any lost data. While their Irish counterparts pay the extorters, fix their systems, and move on with their lives.
There's still a problem - nothing's stopping India, Australia, and Ireland in your example from benefitting from the reduction in ransomware without paying the costs for disincentivizing it. Free riders are a problem for public goods, such as low-crime environments.
You don't need to make it illegal to pay ransomware to use this type of logic to stop ransomware. Here's an alternative version:
It should be illegal to deploy ransomware. Raise the minimum risk-adjusted price (chance of getting caught deploying * fine) by enough, and people will make the rational decision not to deploy it.
But it doesn't work. The chance of getting caught is (currently) so infinitesimal that it is ignored, and ransomware is rampant.
In your system, the chance of getting caught paying would be equally infinitesimal, with the added problem that anybody involved with prosecuting or convicting would fully understand that they are harming the victim rather than the perpetrator.
Someone using a zero-day exploit gets in and encrypts everything that runs my company and demands a ransom in exchange for the key.
Using your logic, my government says I'm not allowed to take measures to get my company back in order.
Why should we further expand the power of the government to make an already shitty situation even more detrimental?
Legislate proper security more, enforce it, fund an electronic police to help combat it.
The taxes paid by the desperate and careless can be used for the expensive international cases against the scammers.
Combine with an advertising campaign to make it common knowledge that paying ransomware gets you fined, and that you should have good backup-and-restore ability instead, and the problem should become much less intense.
(side note: paying ransomware has negative externalities, since it funds ransomware operations that hurt others. If criminalizing it offends your libertarian aesthetic, think of it as a Pigouvian tax instead.)