Up 17% so far in 2023 on a total return basis, the S&P 500 is well on its way to posting a solid rebound year after struggling in 2022. However, three notable stocks have not matched these gains, with two of the stocks declining year to date.

With total returns of -15%, -4%, and 10% this year, American Tower (AMT -0.14%)Canadian National Railway (CNI 0.46%), and Casey's General Stores (CASY -0.42%) have lagged the index. Despite this short-term underperformance, investors may want to zoom out and take notice of the decades-long potential each company may hold.

Along with providing steadily growing dividends, these three businesses have cornered unique niches in their industries and could provide market-beating returns to buy-and-hold-forever investors.

1. American Tower

American Tower is the largest business in its increasingly important industry. It owns and operates over 226,000 communications towers across the globe. American Tower offers a must-have value proposition to communications behemoths globally by leasing its vast real estate footprint to customers such as Verizon, AT&T, and T-Mobile, along with their international peers.

The company's niche focus means it can more efficiently service, maintain, and upgrade its towers than its customers could ever do on their own, allowing them to focus on their core operations. This leasing business model is highly profitable for American Tower, especially once it adds two or more tenants to its towers. As the company adds a second or third tenant, revenue is often roughly doubled or tripled, while the variable costs needed for these new tenants only increase incrementally.

With the U.S. set to see annualized mobile data growth of 21% through 2028 -- and most of the world seeing similar growth rates -- American Tower is well-positioned to maximize the full potential of its towers over time. 

Despite this upside, the company's share price has declined roughly 36% over the last year. After seeing the company saddled with over $39 billion in debt during a rising interest rate environment, the market seems to be taking a more cautious approach to American Tower's stock.

However, with $62 billion of non-cancellable leases on its books -- and generating over $5 billion annually in earnings before interest, taxes, depreciation, and amortization (EBITDA) -- the company should easily handle its debt obligations. Furthermore, 85% of its debt has fixed interest rates, making it less susceptible to today's interest rate hikes. 

Now trading with its highest-ever 3.5% dividend yield and a decade-low price-to-sales (PS) ratio, American Tower's long-term potential looks to be selling at a discounted valuation.

Charts showing American Tower's dividend yield rising, and PS ratio falling, since 2022.

AMT Dividend Yield data by YCharts

As American Tower steadily reduces its leverage while digesting its $10 billion acquisition of data center real estate investment trust CoreSite, look for the world's unquenchable thirst for data to push the company's profitability back to old highs.

2. Canadian National Railway

Canadian National Railway has a durable geographic moat compared to its railroad peers, spanning Canada from coast to coast and running through the U.S. via Chicago to the Gulf of Mexico. Thanks to this intricate network of iron rails across North America, Canadian National maintains an efficient scale advantage, meaning that smaller railways are disincentivized from ever trying to overtake it.

Powered by this almost impenetrable moat, the company has consistently delivered a return on invested capital (ROIC) above its weighted average cost of capital (WACC) -- currently at 15% and 8%, respectively. In simplest terms, when a company's ROIC is higher than its WACC, shareholder value is created. Thanks to this healthy, self-sustaining business model, Canadian National has posted total returns three times larger than the S&P 500 over the last two decades.

Despite this incredible run, the company trades at just 23 times free cash flow (FCF) -- its lowest valuation since 2016.

Chart showing Canadian National Railway's price to free cash flow down since 2020.

CNI Price to Free Cash Flow data by YCharts

This generous discount allows investors to buy one of the most stable businesses on the market -- and its 2% dividend -- for a once-in-a-decade price. In addition to its dividend payments nearly tripling over the last decade, its payout ratio -- or the percentage of net income used to pay a dividend -- remains at a reasonable 39%. Better yet, Canadian National has lowered its share count by 22% over the same time, helping to juice FCF-per-share figures. 

This one-two punch of strong shareholder returns and high ROIC make Canadian National and its diversified markets a great buy-and-hold-forever investment built to weather any market condition.

3. Casey's General Stores

Home to over 2,500 pizza shops that happen to sell fuel, Casey's General Stores has become the fifth largest pizza seller by number of kitchens in the U.S. With 50% of its stores in locations with less than 5,000 people, Casey's acts as the cornerstone to many tiny towns across the Midwest, building a loyal customer base over 6.5 million members strong.

Consider that during the height of the pandemic, the company saw increased cash from operations and net income, despite sales falling due to the lockdown's effect on fuel consumption.

Chart showing Casey's General Stores' cash from operations and net income rising since 2014.

CASY Cash from Operations (TTM) data by YCharts

This event acts as a microcosm of what makes Casey's unique in the fact that it has become a staple in the lives of many of its customers. And this isn't just to buy gas. On the company's most recent investor day, management stated that roughly 75% of its inside transactions did not include fuel.

Now eyeing an expansion into the South and the Southeast, Casey's plans to keep this pizza and inside sales focus while acquiring new stores and renovating them with kitchens and the company's popular food offerings. With 22 consecutive years of same-store sales increases and 24 straight years of raising its dividend, Casey's and its large following make it an excellent pick to ride out any economic weirdness alongside.