In all of the cases I am aware of, it was not the cake that was the problem, but having 2 grooms or 2 brides on top. it was when this was requested/demanded that the refusal was made. If you have that to do something is immoral, there should be no law forcing you to do it. Even if it cause someone to go to a different bakery, God forbid!
And you are correct, there are legal penalties, just as there was in Germany if you conspired to hide a jew. My point in this last part is to illustrate that just because it is a law, does not make it right.