For example, in Massachusetts anyone can become a marriage officiant by applying to the governor. There's a form; permission is always granted. As a result, I have performed two marriages.
The better question is, what happens to a civil official who declares that it is against their religion to perform their civil duty?
Religious institutions are not considered public accommodations so they are not required to offer their services without discrimination to protected classes.
Now, based on no legislation (as one dissenting Justice makes scathingly clear), a new "protected class" has been created. The baker still considers a pair entering that "protected class" not a "wedding", a view the ruling notes still should be respected and free to hold & act on.
Furthermore, the bakery is probably not a public accommodation under federal law unless it's principally selling food for consumption on the premises.
IOW, even though they provide a service, it is not the same class of service, legally, as a cake maker or any other for profit entity serving the public.
What if their services are funded by the government, such as services to the poor? Can they refuse poor gay people?
It seems like an unlikely, and possibly illegal, situation.