Apple (AAPL 1.93%) stock finished 2023 up 47%, but the shares have slipped about 4% in 2024 so far. Wall Street is nervous about slowing iPhone sales (roughly half of Apple's business) and weakness in China, where the company generates one-fifth of its sales.

But something is cooking in Cupertino, California. Apple spent 7.8% of its total sales last year on research and development (R&D) expenses, or nearly $30 billion. That's the highest percentage of its revenue in 20 years, around the time when the tech titan was expanding its iPod and music business and developing the first iPhone.

AAPL R&D to Revenue (TTM) Chart

AAPL R&D to Revenue (TTM) data by YCharts

Apple's R&D has been steadily climbing over the last decade, but there hasn't been a major new product since the Apple Watch in 2015. The new Vision Pro headset is coming this year, but the company hasn't made any significant changes to the design of its existing products in years.

When we look at where Apple is investing its cash, it may not necessarily point to lots of innovation on the product front, but it could still have a major impact on Apple's returns to investors.

Apple is widening its competitive moat

When asked on the company's fiscal fourth-quarter earnings call, CEO Tim Cook explained that the increase in R&D is going toward a lot of things:

It's ... some things I can't talk about. It's Vision Pro. It's [artificial intelligence] and [machine learning]. It's the silicon investment that we're making, the transition with the Mac and other silicon.

The silicon he's referring to is the transition away from Intel processors to its own chips for Mac and other products.

Apple has invested for many years in artificial intelligence (AI) and machine learning, most notably in the Siri voice assistant. Cook hinted there's more going on, but that could mean many things for Apple's product development road map.

The problem is that Apple is a gigantic company with $383 billion in annual revenue. When the iPhone was first released in 2007, Apple was a fraction of that size. The days of releasing a single device that moves the needle and sends the stock to the Moon are long gone.

However, all the things Cook mentioned are going toward widening the company's competitive moat and building a more profitable business. This explains why Warren Buffett continues to hold a massive stake in Apple stock, and why investors should consider holding shares, too.

Apple's investments are creating enormous shareholder value

Apple is not releasing groundbreaking new products that change the world, but it's enjoying a strong profit margin that is starting to trend toward record highs again. This is why the stock climbed 47% in 2023 despite lower sales.

AAPL Profit Margin Chart

AAPL Profit Margin data by YCharts

Higher margins can be traced back to the company's boost in R&D spending. Cook mentioned some of the R&D increase is going toward AI. This technology is the backbone of many features on the iPhone, including Siri, searching photos, Face ID, and the neural engine that enables the iPhone's camera to capture better images. These features raise customer satisfaction and spending on services, which generate twice the margin of hardware products.

Services, including sales from apps and subscriptions, is Apple's fastest-growing business, expanding 9% year over year in fiscal 2023. Management clearly sees more growth for services over the long term.

"Our installed base of over 2 billion active devices continues to grow at a nice pace and establishes a solid foundation for the future expansion of the ecosystem," CFO Luca Maestri noted on the last earnings call.

Because services still only makes up 22% of Apple's total sales and is growing faster than other sales categories, its margins and profits should remain on an upward trajectory. Management is directing investment at the heart of Apple's competitive advantage, which is its brand and user experience, and that spells rising profits and dividend increases, as well as a stock that should be hitting new highs for years to come.