The simple answer is for churches to make a policy that only people who have been members for some time and are paid up on their tithes can get married in the church.
That’s not going to do it. Plenty of gay people go to church.
Is there any law against charging them huge, gigantic sums of money to perform a marriage ceremony? That might discourage most of them.
That won't work. Let's say you amend your constitution and by-laws to say this. Now let's say a member of your congregation has been coming for years and is a member in good standing...but has been living a secret gay life and now wants to marry their partner.
By your definition...and your constitution and by-laws...you have no recourse....and that would open the door up for a law suit because you violated your own constitution and by-laws...which are necessary for your 501c3 status.
No...the ONLY option is for pastors to get OUT of the marriage license business and say they will only conduct religious ceremonies of marriage....and if you want a legally binding sheet of paper....let the State do it since the State has decided they can define it.