"Ah, I see you understand," Starswirl said, "Celestia got the recipe from Pinkie Pie whom probably got it from her mother, who in turn perhaps got it from a friend of her parents and so on, back all the way to Celestia. The truth is, cake has no inventor, it was spawned by an infinite loop in time.