Berkshire Hathaway owns a lot of stocks in its huge $347 billion portfolio. The average investor could peek at this list of holdings to find potential investment opportunities to allocate some cash to. 

Among some of the relatively smaller positions that Warren Buffett owns, investors will find Visa (V -0.23%) and Mastercard (MA 0.07%). Both stocks have crushed the broader market in the past decade. 

It's worth learning more about these incredibly lucrative card payments giants, which just might be two of the best businesses in the world. 

Outstanding financials 

When looking at stocks to buy, Buffett certainly seems to prioritize financially sound companies. Apple, representing 47% of the overall portfolio, is one of the most profitable and cash-rich businesses on the face of the planet. When it comes to the financial picture, Visa and Mastercard are in the same category as the iPhone maker. In fact, they just might be better. 

In the three-month period ended June 30, Visa and Mastercard posted operating margins of 61.8% and 58.3%, respectively. I'm sure it would take you a long time to find businesses that can match this level of profitability. 

These companies generate lots of free cash flow (FCF), too. Visa made $17.9 billion in FCF in its last fiscal year, which represented a whopping 61% of overall revenue. Mastercard produced $10.1 billion in FCF in 2022, or 45% of total sales. This has allowed both businesses to pay steadily rising dividends over the years, while also repurchasing shares. Buffett definitely appreciates these capital-allocation moves. 

Economic moat 

There's no doubt that Buffett seeks out companies that possess an economic moat, a term that is usually associated with him. As a long-term investor, finding businesses with this competitive advantage helps raise the chances that they will still be leading their respective industries and generating strong profits well into the future. 

Visa and Mastercard both benefit from having a network effect, which could arguably be the strongest type of economic moat. Each company has billions of its branded cards in circulation that are accepted at tens of millions of merchant locations around the world. These companies operate a two-sided model that gets more powerful as it gets bigger. More merchant acceptance points mean there are more places to shop for cardholders. And more cardholders translates to a larger potential customer base for merchants. 

In the U.S., Visa and Mastercard combined control about 87% of the market for card payments, having essentially a duopoly position in the industry. By processing trillions of dollars each on a quarterly basis, it's virtually impossible that these two payments networks get disrupted. The barriers to entry are insurmountable. If someone wanted to start a competing payments platform from scratch, it would be extremely difficult to bring on consumers without any merchants, and vice versa. 

And while popular fintech companies, particularly PayPal and Block, get a lot of attention for their disruptive potential, a valid argument can be made that they actually benefit Visa and Mastercard by propelling adoption of digital payments. 

Look at the thousands of stocks out there, and it would be a tall task finding a business that has a stronger competitive position than Visa or Mastercard. 

Looking at the valuations 

Although the impressive financials and powerful economic moats are definitely some factors to get excited about, it's also worth pointing out that these stocks are expensive. Visa and Mastercard trade at a price-to-earnings (P/E) ratio of 30 and 37, respectively. To be fair, these are cheaper than their trailing-five-year average P/E multiples, but they represent a significant premium to the overall S&P 500. 

Investors who care more about paying the right price when buying stocks could wait for a potentially better entry point. However, I also think it's a reasonable course of action to decide to pay up for these two fantastic companies.