Marketing, ambience, and because there's not always a McCafe around.
FYI - I did see the cakes getting loaded into the cabinet at McCafe once. The boxes said they came from a "bakery" in Queensland somewhere.
Off topic, but if you want to try some really good locally made cakes, try Ginger Bakery in Wanchai on Johnston Road (close to The Pawn). Their Banana Cream tart is to die for.