This is very important because freedom of speech also has the nuance in that there's also protects against compelled speech. And on this there's a couple of really interesting components. The courts have ruled a wide range of things from stained glass windows to even topless dancing as expressions protected by the first amendment, and so 'cake art' almost certainly falls within this protection. This is even implied in the price. Wedding cakes can run hundreds of dollars, yet the cost of the ingredients and even labor is a tiny fraction of that. People are paying for the artistic expression of the person creating the cake.
A different argument might be that nobody could think that the baker creating the cake was itself an endorsement of gay marriage. One of the many interesting 'friend of the court' filings here dealt with this. There was an interesting case in New Hampshire who's state slogan is Live Free or Die. This was (is?) emblazoned on all license plates from the state, but one individual took issue with this as it did align with their own moral beliefs, and so they sued the state and this case ended up at the US supreme court. The state lost. The point here is that nobody could reasonably believe that the individual with 'life free or die' on the license plate was actually endorsing such a view, since it was a standard part of the kit for everybody - yet even when no individual can reasonably believe that some form of speech might be endorsing a view (or reflective of the individual who is indirectly 'expressing' such a view), one cannot be compelled to expressions that they find offensive.