This phrase is easier to understand if it is read as "You can't eat your cake, and have it too". Obviously once you've eaten your cake, you won't have it any more. Used for expressing the impossibility of having something both ways, if those two ways conflict.
He works so hard to pay for that fancy house of his that he never has any time to stay home and enjoy it.
When someone wants all of the benefits of a relationship without the commitment. Typically used when seeking sexual favors
Billy has been trying to get with Sally for the past few months, but she won’t sleep with him unless they’re in a relationship. She told him, “ you can’t have your cake and eat it too”
you share an idea with a colleague and then hear him repeat it in a meeting, it is well received and he accepts all the praise.
Later on that night you talk about it at home with your wife and she agrees he took the cream off your cake