Somehow they have managed to do it. Public officials have been bending the rules in favor of what amounts to no less than a religious view of the all-powerful state, in despite of the law, for most of my life. Apparently it's not a problem when the religion of secularism is the one so favored. Of course, that religion teaches that what the state calls marriage, IS marriage, but all that is meant is a sort of semipermanent legal arrangement.
Hey, they can call it marriage if they want, but then the mystical union between a man and a woman which has both a long pedigree and is recognized all over the world, would have to be called something else. Propose that, and see how far it flies.
Your examples don't serve you well, because both Catholics and Jews are long contributors to the theory and practice of marriage, and they definitely both consider that it can only exist between a man and a woman. Your hypothetical town clerk might suspect that a marriage can't exist between this particular man and woman, but that has always been the job of the couple, their families, and their friends to sort out, and in the America I remember, that's exactly what would happen,and the town clerk would know it. Only way they could handle it, since neither Catholics nor Jews are so monolithically consistent that they all agree what is a barrier to a marriage.
The people of New York need to change the law.
This town clerk in New York has no more a right to refuse to issue marriage licenses to gay couples, than a town clerk Texas has a act against Texas law and issue marriage licenses to gay couples.