Billionaire investor Warren Buffett, who leads Berkshire Hathaway (NYSE: BRK.B)(NYSE: BRK.A), has made an artificial intelligence company the largest holding in Berkshire's $371 billion portfolio. Ironically, that may not have been his intention when he first purchased the stock in early 2016.

Warren Buffett has long been a fan of iPhone maker Apple (AAPL -0.35%). He's repeatedly praised the company for its strong brand power. Loyal iPhone users continually buy new phones, creating billions of dollars in profit that trickle back to Buffett via dividends and share repurchases.

Today, Apple is using artificial intelligence (AI) to strengthen its core business, and its stock has appreciated considerably over the past eight years.

Should investors still buy and hold the stock, or did Buffett beat investors to the punch?

Here is what you need to know.

AI is infiltrating Apple's business

For some companies, AI is apparent. But not so much for Apple. The company still makes most of its money by selling iPhones and other hardware and service subscriptions for music, news, gaming, and more. But rest assured, Apple is implementing AI throughout the iOS experience.

For example, Apple uses AI to accurately scan your face and verify your identity when using Face ID. Open up your photo gallery, and AI features will automatically prepare collages and short films or let you edit and enhance photos. Your iOS keyboard will learn from your input, predicting words you might use and autocorrecting when you make mistakes.

Ultimately, Apple is using AI to improve the user experience on iOS. You could already argue that iOS is wonderfully sticky. After all, who wants to move all their apps, passwords, media, etc., to a new smartphone brand? With Apple, it backs up to the cloud and automatically loads up on a new iPhone like it never left. But continual improvements and features make you increasingly likely to keep returning to upgrade your devices.

Buffett might not have thought to buy Apple because of AI. Instead, the company's fantastic product and brand power probably caught his eye. However, AI is instrumental to Apple continually improving its products and brand power. That's the key.

Buffett did get into the stock early

Whether by luck, intuition, or skill, Buffett has proven very opportunistic throughout his career. His Apple investment might be the best example of this. Berkshire began buying Apple in early 2016. As you can see, the stock traded at its lowest price-to-earnings ratio at the time, just 10 times its earnings:

AAPL PE Ratio Chart

AAPL PE Ratio data by YCharts

Apple has since grown into a much larger business. The stock has returned roughly 700% since the beginning of 2016, a combination of growth and a stock valuation that's steadily risen over the past eight years.

Today, Apple trades at a much higher P/E ratio, over 31 times earnings.

Should investors today own Apple?

Whether investors should buy and hold Apple boils down to two questions. First, is Apple still a fantastic business? I think it's evident that it is. There are over 2 billion active iOS devices today, and Apple has generated just under $100 billion in free cash flow over the past four quarters. That's more cash profit than most companies produce in revenue.

That could explain why Apple has grown to represent roughly half of Berkshire Hathaway's portfolio.

The other question is whether buying the stock makes sense at its current price. That's a more challenging question because Apple is far more expensive than it was in 2016. It's also harder to grow when you reach such a massive size. Analysts believe Apple's earnings will compound at almost 10% annually over time, which makes its P/E ratio a steep price for that growth.

If you're like Buffett and already own the stock, it's probably safe to retain those shares and count on holding for years to come. Some companies are so good that you shouldn't overthink it -- own the stock. But it's tough to pull the lever at these prices for those on the outside looking in. Consider waiting for a better buying opportunity, or buy a little now and slowly dollar-cost average into an investment.