There is a clear problem with that approach, which is that it fails to take into account the pressure that society can place on small businesses, especially in small to medium areas.
Given two cake makers in town, if one is happy to provide cakes to gays, and the other is not, in general the town will provide custom to the shop whose stance they agree with.
By passing a law that forces both shops to behave the same way, the opportunity for social pressure to be applied is reduced.