Editor's Note: This article may contain Spoilers about the game Portal.
In Portal you are required to do numerous tasks in a research facility guided by a computer named GlaDOS, who repeatedly mentions that following the experiment, there will be cake.
As the game progresses, the player finds messages written on the walls as warnings from Doug Rattmann, an old lab worker who has been featured on the Lab Rat comic series. One message scrawled on the walls in later levels reads "the cake is a lie. the cake is a lie. the cake is a lie. the cake is a lie":
It is later revealed in the game, that in order to keep the AI GlaDOS from killing everyone, she is fitted with an AI "personality core" that continuously list off the directions and ingredients needed for baking a cake. In addition, the ending credits sequence that follows the game features a song called, "Still Alive" which mentions the cake and features a sole cake at the bottom of the test facility. This cake is a virtualized cartoon version of a Black Forest cake that was sold near Valve Headquarters.
From Reference to Idiom
After the game's release, "the cake is a lie" was widely popular between Portal players, but soon it spread to forums and blogs where the phrase began to take on a new meaning outside of the context of the game. People were using the phrase, "The cake is a lie", on forums as an idiom meaning, "You are chasing after an empty, unattainable goal."
Roughly translates to "your promised reward is merely a fictitious motivator". Popularized by the game "Portal" (found on Half-Life 2's "Orange Box" game release for PC, X-Box 360, and PS3). During the game, an electronic voice encourages you to solve intricate puzzles using cake as a motivating perk. When you have "broken out" of the game's initial testing phase (from threat of death), you find scrawls on walls of the innards of the testing center warning you that "the cake is a lie".
Employee #1: Yo, Dave, manager says we will probably get a promotion if we meet the sales expectations for this quarter.
Employee #2: Yeah, so, don't get your hopes up on that one, Ed. The cake is a lie.
Employee #1: Really, aw crap.
In Portal 2
In a interview with Gamasutra, Portal writer Erik Wolpaw expressed no interest in using the cake trope in Portal 2:
"If you thought you were sick of the memes, I was sick of it way ahead of you," said Wolpaw, who was the primary writer on Portal and one of two writing leads on its upcoming sequel, which was demonstrated this week at the E3 Expo. "For instance, cake," he added. "I've had enough cake jokes."
Though it largely was absent in referencing throughout most of the game, a fake door in Chapter 5 promised to lead to a "Cake Dispenser" before falling down which again, meant the cake was a lie.
In Popular Culture
Search queries for "the cake is a lie" began in October 2007, which coincides with Portal's October 9th, 2007 release date.
 Gamasutra – Portal 2's Wolpaw: 'I Do Not Want To Resurrect A Three-Year-Old Meme' / 6/18/2010