Anybody who knows Warren Buffett well knows he's a fan of The Coca-Cola Company (KO 0.19%), both the stock and its namesake product. As a matter of fact, Coca-Cola is the largest holding in the portfolio of his company, Berkshire Hathaway, with a market value of nearly $17 billion. Warren famously declared at the 2012 Berkshire Hathaway annual shareholders meeting, "If you gave me $10, $20, $30 billion to knock off Coca-Cola, I couldn't do it."

However, things haven't been great for the soft-drink maker recently. During the last five years, the company has provided investors a return of 65%, while the S&P 500 has provided a return of nearly 100%. On a more recent basis -- during the last year -- those numbers are 9% vs.19%, respectively. What's going on with Warren's favorite investment?

Demographic headwinds
Changing attitudes, exacerbated by demographic trends, appear to be the root of the problem. Health-conscious consumers are abandoning Coke and Diet Coke amid concerns of excessive sugar and artificial sweeteners. In addition, soda consumption last year is near levels from the early '90s in the U.S., coming in at 42.2 gallons a year per capita. The big winner during this period is bottled water; on a per capita basis, bottled water jumped from mid-single digits to more than half of soft drink's total, by jumping up to 22.1 per capita last year.

Coca-Cola's new campaign, "Share a Coke," is its way to reverse sluggish sales.

Among U.S. millennials, the trend is even more pronounced. More concerned with food and beverage quality than prior generations, millennials have been replacing sugary sodas with water, coffee, and tea. However, one noticeable departure from this is the generation's affinity for energy drinks.

This trend hurts Coca-Cola more than its bubbly brethren, PepsiCo (PEP -0.09%), due to Pepsi's large presence in the snack food markets through its Frito-Lay and Quaker Oats brands. During the year, shares of Pepsi were up nearly 15%, although it's prudent to mention that it trails Coca-Cola slightly during the last five years with a return of 59%.

Coke is adjusting
Coke is adjusting to the changing demands by adding products to its arsenal. In order to tap into these higher-growth markets, Coca-Cola agreed to pay $2.15 billion in cash to take a 16.7% stake in Monster Beverage. The company hopes to tap into the energy drink market's growth through Monster's Energy brand, a product that did very well against Coke's Full Throttle brand.

Monster Beverage is one way Coke seeks to grow revenue. Source: Monster Beverage.

The deal has the potential to turn around Coke's woes in international markets, where its products are also languishing. Global soda sales growth from Coca-Cola has slowed for three years straight. Monster Beverage gets access to Coke's excellent worldwide distribution and logistical operations.

As these products hit new markets, look for growth from both companies. Obviously, this is better for Monster than Coke due to a smaller revenue base and larger ownership of the Monster brand; but both companies will benefit.

Final thoughts
Coke's seen better days; but, as a long-term investor, Warren Buffett is undeterred. At Coke's 2013 Annual Shareholders meeting, he commented, "We've never sold a share of Coca-Cola stock and I wouldn't think of selling a share." He continued:

When you've got a great business like Coca-Cola, the danger would always be that you would rest on your laurels. I see none of that at Coca-Cola. Tomorrow is more exciting than today.

While Coke's namesake product faces demographic and perception challenges, particularly in the United States, the company is looking to new markets and products for growth. And while the company's seen better days, I wouldn't bet against it.

Many a fortune has been made by investing like Buffett. investors would be wise to pay attention to The Oracle of Omaha.