If you compare like for like quality wise homemade is cheaper. You can buy a chocolate cake very cheaply, but it will taste a bit synthetic and not really chocolately. A homemade cake will be more expensive than the cheapest cake you can buy, but cheaper than a high quality cake made with "proper" ingredients iyswim. Especially if you avoid brand names etc for ingredients - value dark chocolate is fine for baking.
I make my own bread (Bread maker kneads it but I cook it in the oven as it's nicer that way) and it probably costs about 50p a loaf. Plus energy costs to make it, but still not that expensive. Lidl bread flour and instant yeast is quite cheap.