An expression used to showing how grateful and indebted you are to someone.
Contrary to popular opinion this does not come from the act of actually baking someone a cake to thank them. It actually comes from the dance move known as baking the cake
. The baking the cake
move can be considered a form of thanks between friends in a party context.
Thanks for letting me use your flat for the party. I'll bake a cake for you.