I'm just going to talk about the US. The First Amendment to the US Constitution codifies that
Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof;...
What is clearly prohibited by this Amendment would be Congress (or any inferior legislature via the 14th Amendment) restricting the ability of religions which refuse to marry same-sex couples from marrying opposite-sex couples, or in general outlawing any kind of religious law about who a particular church is willing to marry (e.g. only marrying if both parties are of the religion). However, legislatures are generally allowed to influence action via government inducements (I'll just use inducements to describe subsidies, tax breaks, etc). The current precedent for determining whether a particular legislative action violates the Establishment Clause is the "Lemon Test," from Lemon v. Kurtzman, which has the following test:
Government action violates the Establishment Clause unless it:
- Has a significant secular (i.e., non-religious) purpose,
- Does not have the primary effect of advancing or inhibiting religion, and
- Does not foster excessive entanglement between government and religion.
On the first point, I think the law fails - inducing religious establishments to perform same-sex marriage does not have a "significant secular purpose" because ultimately the government doesn't care whether or not you have a marriage ceremony, just that you sign a marriage certificate with an appropriate witness, which can be a government official. The law could survive on the second point if it could be shown to have at least the preponderance of being for social good, if it is argued that the law's purpose is to make church marriage ceremonies more accessible for same-sex couples by inducing more churches to perform them, and not to harm churches that don't perform them. However, this would probably be an uphill battle, since the law has the practical effect of promoting some religions' beliefs over others. The law probably fails on the third point as well, going back to the previous point that it effectively results in the government choosing one religious practice to promote over another.
However, the Lemon Test often criticized or entirely disregarded by the current Supreme Court, for example in the case American Legion v American Humanist Association (a case decided by the current Supreme Court):
This pattern is a testament to the Lemon test's shortcomings. As Establishment Clause cases involving a great array of laws and practices came to the Court, it became more and more apparent that the Lemon test could not resolve them. It could not "explain the Establishment Clause's tolerance, for example, of the prayers that open legislative meetings, . . . certain references to, and invocations of, the Deity in the public words of public officials; the public references to God on coins, decrees, and buildings; or the attention paid to the religious objectives of certain holidays, including Thanksgiving.
Even without the Lemon Test, we can look at Walz v. Tax Commission of New York for an idea of when tax breaks for religious establishments is allowed (emphasis mine):
The legislative purpose of the property tax exemption is neither the advancement nor the inhibition of religion... New York, in common with the other States, has determined that certain entities that exist in a harmonious relationship to the community at large, and that foster its "moral or mental improvement," should not be inhibited in their activities by property taxation or the hazard of loss of those properties for nonpayment of taxes. It has not singled out one particular church or religious group or even churches as such;... The State has an affirmative policy that considers these groups as beneficial and stabilizing influences in community life and finds this classification useful, desirable, and in the public interest.
This paragraph seems to provide some argument both ways. First, the bolded section would seem to prohibit using government inducements to promote one religious practice over another, and that the government can only assist religious institutions when the assistance is applied equally. On the other hand, states are allowed to grant tax relief to religious organizations "that foster..."moral or mental improvement,"..." A legislature could argue that the law promotes "moral improvement" by encouraging acceptance of same-sex marriage, rather than a particular religious belief. However, I don't think that such an argument would prevail over the general prohibition on promoting any religious exercise over another. Government assistance for religious organizations is very thinly held to be permissible only when it is equal. In my opinion, the Supreme Court already has to use twisted gymnastics to argue in favor of any government assistance of religious organizations granted because of their religious status, so they are unlikely to allow something this far (especially since it is usually the conservative justices arguing in favor of these policies, and they are less likely to do same-sex marriage any favors).
On the other hand, a permissible policy may be to have government grants for any organization that performs same-sex marriage ceremonies, whether or not that organization is religious. Whether or not that is allowed is likely going to depend on what proportion of the receiving organizations are religious in nature, but there may be enough hotels and other non-religious venues that would qualify that such a law might survive.