The cake in your most recent scenario is 1 .a completely generic food item, 2. has no indication that it's for a specific wedding, 3. has no emotional value to any of the people involved and 4. is already made, so you don't have to answer whether someone can be forced to make it.
Don't change my hypothetical. My cake is a completely customized and specially ordered food item that was fully indicated to be for a specific wedding and has emotional value both for me, for the person I'm giving it to, and possibly for the baker as well. It is already made though, I'll give you that.
So, by "allowed", I mean is it ethically acceptable. Am I doing something wrong by giving this cake to my friend? Why is what I'm doing wrong? What are my moral obligations here? How much authority does the baker have over what I do with the cake after I take delivery? Is the cake mine to do with as I wish, or is it not?
Time flies like the wind, and fruit flies like a banana.