Warren Buffett once said that "all there is to investing is picking good stocks at good times and staying with them as long as they remain good companies." Wow! In one sentence, he just encapsulated what it means to be a long-term investor. And that means every company isn't a "hold forever" type of stock. In fact, the most important part of that quote may be the last seven words. 

With this in mind, let's look at two companies that I will buy and hold forever (or at least until the story changes).

1. Amazon

If you follow my writing, you probably expected Amazon (AMZN -1.27%) to make the list. But the "why" might surprise you. Amazon isn't a forever stock because of its dominant e-commerce business, Amazon Web Services (AWS), logistics, or even the onrushing digital ad business. It is a forever stock because of its brilliant ecosystem that weaves them all together.

It starts with the e-commerce business, which generates revenue by selling Amazon's products and fees from products sold by third parties and those that use Amazon's logistics. Sellers also purchase ads and pay for premium product placement, which drives Amazon's $40 billion+ annual ad sales. The digital infrastructure for e-commerce runs on AWS, and many companies that sell on Amazon's site use AWS for their cloud service needs. 

Management has done an incredible job of transforming the company from one reliant on low-margin retail sales to one that generates most of its revenue from higher-margin services. The progression is depicted below.

Amazon's sales by revenue stream.

Data source: Amazon.

Amazon's profits have peaks and valleys, so it is important to take a long view. For instance, economic stimulus checks drove earnings during 2021, but these disappeared in 2022 as increased labor and logistics costs and other issues stemming from COVID-19's whiplash effect on the economy plagued the company. 

For this reason, long-term investors should judge Amazon on sales and expansion into desirable industries. Second-quarter earnings surprised many as sales grew 11% to $134 billion despite a slowing economy. Artificial intelligence (AI) also spells opportunity. AI programs require enormous computing power and lots of data, which will be a boon for AWS in the coming years. AWS also offers platform services for customers to develop AI programs, like chatbots and image generators.

The Federal Trade Commission (FTC) has noticed Amazon's ecosystem and believes it has unfair advantages. Reports indicate that it will soon file suit against Amazon. No one knows how this will play out, as I discuss in detail here, but there is no reason for shareholders to panic. Many companies have drawn the ire of the FTC and gone on to create spectacular wealth for shareholders. Microsoft stock gained 1,370% since the lawsuit filed in 1998 alleging it held an illegal monopoly on the personal computer (PC) market. 

Amazon's business model, growth, excellent management, and fresh opportunities in AI make this stock a bedrock of my long-term portfolio. 

2. Visa

We are a consumer-driven society. Consumer spending accounts for two-thirds of all economic activity in the U.S. It's true! Consumers are the bedrock of our economy, which is the linchpin of the global economy. For this reason, fiscal and monetary policy favors consumers during downturns with low interest rates and stimulus (like during the aftermath of COVID-19). And, of course, when the economy is humming along, folks also spend lots of money on goods and services.

For this reason, holding stock in Visa (V -0.41%), the world's most prolific transaction processor, is a terrific long-term strategy. According to Statista, nearly 40% of credit or debit card transactions across the globe in 2022 used a Visa card to make $242 billion in purchases. Staggering numbers. 

As shown below, Visa's dominant position leads to tremendous margins and lucrative cash flow.

V Operating Margin (TTM) Chart
V Operating Margin (TTM) data by YCharts.

A 67% operating margin is ridiculously good and even higher than Mastercard's (NYSE: MA) 58% margin. As the chart above shows, free cash flow and margins dipped during COVID-19 but quickly bounced back as monetary and fiscal policy rushed to the rescue. 

Visa has two other advantages for long-term shareholders. It is inflation-resistant. Revenue rises when prices rise since it charges a percentage of the total transaction price. The company also benefits from an increasingly cashless world. Even vending machines now accept credit cards. 

Long-term investors get two stalwarts of the U.S. economy with Amazon and Visa. One has arguably the strongest ecosystem on the planet, and the other powers consumer spending, which powers the world economy. This makes them "forever" stocks in my book.