Wall Street legend Peter Lynch once told investors to simply "buy what they know." That is solid advice for novice investors, and a great place to shop for investment ideas is your local supermarket.

Source: Pixabay

Everyone needs to eat, so it would be reasonable to assume that manufacturers of top food items should be solid investments. Let's take a look at three familiar players -- Coca-Cola (KO 0.15%), PepsiCo (PEP -2.97%), and General Mills (GIS -0.49%) -- to spot their fundamental similarities and differences.

Top line growth
Coca-Cola, PepsiCo, and General Mills all sell a huge variety of drinks and processed foods. Here is a partial list of some of their most well-known brands.

Coca-Cola

PepsiCo

General Mills

Coca-Cola, Sprite

Perrier, Dasani

S. Pellegrino, Nestea

Minute Maid

Pepsi, 7-Up

Tropicana, Ocean Spray

Quaker, Cap'n Crunch

Frito-Lay chips

Cheerios, Cocoa Puffs

Fruit Roll-Ups, Green Giant

Betty Crocker, Pillsbury

Haagen-Dazs, Yoplait

Source: Company websites

The key difference between Coca-Cola and PepsiCo is that the former only sells drinks, while the latter sells drinks, snacks, and other packaged foods. General Mills is highly dependent on its core cereals business.

However, many processed foods are now being shunned by health conscious consumers. Soda sales, for example, fell for ten straight years between 2004 and 2014. Last year, sales volume of Coke fell 1.1% annually as Pepsi slipped 1.4%. Demand for sugary breakfast cereals is also declining, which caused cereal sales at General Mills and Kellogg to decline annually last year. Nonetheless, all three companies have posted steady sales growth over the past five years.

KO Revenue (TTM) Chart

Source: YCharts

The key to that growth was a diversification toward healthier products. Coca-Cola introduced "zero-calorie" sodas while diversifying into teas and bottled water. PepsiCo started promoting Quaker and Tropicana products more heavily than its chips and sodas. General Mills reduced the sugar content in Yoplait yogurt and acquired organic food maker Annie's Homegrown last September.

Unfortunately, consumer demand for healthier foods is now outpacing the pace of that diversification. Last quarter, Coca-Cola revenue only inched up 1.3% annually, while PepsiCo sales fell 3.2% and General Mills sales growth remained flat.

Bottom line growth
Meanwhile, bottom line growth at all three companies has been hampered by food inflation, which is caused by the growing global population and climate change. Between June 2010 and June 2015, food costs for urban consumers rose an average of 12%, according to the Federal Bank of St. Louis.

This pressure forces processed food makers to hike up their prices to protect their bottom line. As a result, net income growth has not come as easily as sales growth over the past five years.

KO Net Income (TTM) Chart

Source: YCharts

To make matters worse, a strong dollar is gobbling up the profits of these companies overseas. Last quarter, Coca-Cola reported a six percentage point headwind on its earnings. PepsiCo expects foreign exchange rates to reduce revenue and earnings by roughly seven percentage points throughout this year, and General Mills reported a four percentage point currency hit to its operating profit last quarter.

Last quarter, Coca-Cola earnings fell 3.8% annually, PepsiCo eked out a 0.4% gain., and General Mills posted a whopping 30% decline.

The fundamental conclusion
Coca-Cola, PepsiCo, and General Mills respectively trade at 25, 22, and 24 times trailing earnings. By comparison, the S&P 500 trades at 20 times earnings. Although all three stocks might be considered a little pricey by those standards, all three offer forward dividend yields exceeding 3% -- which tops the index average of 2%.

Investing in food stocks is not for everyone. However, analyzing them is a fun way to learn about food trends, commodity costs, and the alarming fact that a handful of companies controls most of what Americans buy at supermarkets. I personally would not build an entire portfolio of food stocks, but well-established brands like Coca-Cola, Pepsi, and General Mills could be worth a look when the market gets choppy.