In the hype tsunami prior to Facebook's May IPO, I doubt anyone wrote these words: "Instead of social media, you should invest in macaroni and cheese." As it turns out, that's exactly what you should have done.

The day Facebook (FB) went public, its shares closed at $38.23, just pennies above the initial asking price of $38. That same day, shares of organic mac 'n' cheese maker Annie's (BNNY) closed at just a little less than that at $36.39. If you'd bought Annie's that day, your shares would be up by nearly one-third right now. Facebook shares, meanwhile, are down more than 40 percent.

You'd be even better off if you'd gotten in on the ground floor of the Annie's IPO in March, when shares were priced at $19. You would have nearly doubled your money on that first day of trading alone. In what kind of world does a company that makes bunny-shaped pasta go public and get a dotcom-style pop, while a social media juggernaut that has fundamentally changed the way humans communicate turns into one of the great stock market stinkers?

The success of the Annie's IPO, and the failure to date of Facebook's, could be just a flukey coincidence. After all, one sells eyeballs, the other kids' food. But the story of Annie's' rise to success doesn't read that differently than that of an internet startup.

Annie's is named after Annie Withey, who started the company with her then-husband Andrew Martin in a fit of what you'd now call serial entrepreneurship. In the mid-'80s, Martin had helped invent a new kind of resealable bag for snack food. The bag needed a product to show it off, so Annie started experimenting in her kitchen and came up with Smartfood, the now ubiquitous white cheddar-flavored popcorn in the black bag. The resealable bag didn't take off, but the popcorn did: Frito-Lay bought Smartfood from the pair for a reported $15 million. Fishing around for something to do next, the two stuck to what they knew: packaging and white cheddar. Annie's Shells and White Cheddar, the mac 'n' cheese in the purple box with the bunny, came out in 1989 and helped pioneer a product niche that more than two decades later has become a big business: healthy convenience food.

Like most scrappy internet startups, the pair did nearly all the work themselves, from writing the homey box copy to delivering cases to regional grocery stores in and around Boston. (Health-food store habitués may be surprised to know that they've never had Annie's all to themselves; mainstream grocery stores have sold their products since the beginning.) Unlike most internet startups, however, they started small and stayed small for a long time.

Image: Google

When current Annie's CEO John Foraker joined the company in 1999 at the peak of the dot-com boom, he says the company had six or seven employees and about $7 million in annual revenue. Sales had doubled by 2002, when private equity firm Solera Capital stepped in with a reported $81 million investment that made it the majority shareholder.

With big money behind Annie's, Foraker says the company developed a "performance-oriented culture" focused on meeting quarterly and annual goals. That could have killed the personality that Annie had instilled in her namesake company, but Foraker says Solera understood that shooting for financial goals didn't mean sacrificing what he saw as the company's vision or its heritage. "It wasn't just a pasta company," he says. "I viewed it as a brand that stood for a lot of important things."

Solera didn't seek a quick exit, which in the packaged foods industry almost always means selling to one of the big players, the way Withey sold Smartfood to Frito-Lay. As a result, Annie's had time to grow organically (pun intended). And just as the company began adding more organic products to its lineup, the mainstreaming of the organic movement was gaining momentum.

With 125 products, from organic BBQ sauce and gluten-free mac 'n' cheese to uncured pepperoni frozen pizza and vegan pretzel bunnies, Annie's went public just as it was hitting what Foraker describes as the sweet spot of its growth curve. The market for convenience foods with ingredients that sound like they originated in nature and not a lab, was moving far beyond the boundaries of Boston and Berkeley, California where the company is now based, along a trajectory from co-op to Whole Foods to Walmart. But Foraker says the majority of grocery stores that carry Annie's products still shelve them off to the side in a "natural foods" section. Foraker's job now is to convince the rest of those retailers that Annie's can go head to head with Kraft, that its products aren't just riding a fad but represent a basic shift in attitude toward eating. "It's really hard to see the broad trend of people wanting to eat healthier changing," Foraker says.

Image: Marcus Wohlsen/Wired

Wall Street mostly agrees. Analysts polled by Thomson/First Call advise to either hold on to Annie's shares or buy more. William Blair and Co. analyst Jon Andersen says the U.S. natural and organic food market is growing by 8 percent annually, much faster than conventional packaged food, and should hit $52 billion by next year.

Andersen says in a note to investors that Annie's is not only a top seller in that market but "has proven crossover appeal" that should grow considerably with its recent launch of frozen pizzas. “We believe that Annie’s has a compelling long-term growth opportunity,” he says.

Not that Annie's is without its detractors. Some investors worry that Annie's' highly visible post-IPO success will spur other companies to slap "organic" on a box of mac 'n' cheese and take a big bite out of Annie's' market. If that happens, it will be interesting to see how well Annie's can keep its commitment to its core values while under pressure from shareholders � a dilemma Facebook knows well.

For now, Annie's seems to be perfectly balancing its responsibilities to Wall Street, while upholding all the things you might expect of a company with an enormous bunny emblazoned on the side of its Berkeley headquarters. An earnest vibe radiates throughout the low-slung building, which houses most of the company's 100 employees. The walls are adorned with slogans like "Create a garden of goodness" and "Share the sunshine," while conference rooms are decorated with murals of hippie goddesses and flowers. And, of course, bunnies. Even the low-flow toilets advertise how much water they save compared to the conventional variety. Frankly, it's exactly the kind of business you'd expect to find in Berkeley.

But that could in a way be a key to Annie's success in the market. Berkeley is a town where people are genuinely committed to their causes, but also aren't afraid to make money (as in the ritzier parts of Silicon Valley, the bursting of the real estate bubble was barely felt in Berkeley). Compared to Facebook, Annie's' value proposition is plain and simple, just like what it sells, but the company also apparently knows how to sell it. Facebook may be a more ambitious and more valuable company at the moment, but like many internet companies, its shares rise and fall based on how confident investors feel it really has anything to sell. Annie's makes a thing you hold in your hand and put in your belly. As fears of another tech bubble persist, mac 'n' cheese makes for some real stock market comfort food.