IBM (NYSE:IBM) and Oracle (NYSE:ORCL) are both often considered mature tech stocks that provide dividends and stability rather than growth. But over the past five years, Oracle's stock has rallied more than 80% as IBMs stock dipped 5%.

After factoring in reinvested dividends, Oracle's total return of 100% also crushed IBM's total return of nearly 20%. Let's see why Oracle outperformed IBM by such as wide margin, and whether or not that trend will continue in the future.

An investor checks a stock chart on a tablet.

Image source: Getty Images.

Similar strategies, different results

IBM and Oracle have both faced similar challenges over the past decade. Demand for their on-premise enterprise products cooled off as they saturated their core markets and faced fresh competition from cloud-based services.

Both companies expanded their higher-growth cloud businesses to offset the declines in their legacy businesses. But IBM's business -- which provided IT services, mainframes, and other products alongside its enterprise software -- had more moving parts than Oracle's, which mainly focused on the database and enterprise software markets.

IBM and Oracle both expanded their cloud platforms with big investments and acquisitions. Yet Oracle's moves, especially its takeover of NetSuite in 2016, turned around its business at a much faster rate than IBM's. As a result, Oracle has generated much stronger revenue growth than IBM over the past five years.

IBM Revenue (TTM) Chart

Source: YCharts

IBM's acquisitions, especially its purchase of SoftLayer in 2013, helped it expand its cloud-based business. But that growth still couldn't offset the slower growth of its IT services, business software, and hardware units. IBM bought Red Hat in 2019 to accelerate that process, and it also plans to jettison its slower-growth managed infrastructure services segment in a spin-off later this year.

Will Oracle stay ahead of IBM?

IBM's revenue and adjusted earnings per share declined 5% and 32%, respectively, in fiscal 2020. However, its revenue rose 1% year-over-year in the first quarter of 2021, and marked its first quarter of growth in over a year.

IBM's total cloud revenue rose 21% year-over-year to $6.5 billion, or 37% of its top line, during the quarter. Its revenue from Red Hat also increased 17%. However, its adjusted EPS still dipped 4%.

Wall Street expect IBM's revenue and earnings to rise 1% and 25%, respectively, this year, if it can continue to expand its cloud-based businesses. IBM plans to spin off the managed infrastructure services unit as a new company called Kyndryl by the end of the year, and the "new" IBM will subsequently expand its higher-growth hybrid cloud and AI businesses.

Oracle's revenue dipped 1% in fiscal 2020, which ended last May, but its adjusted EPS rose 9%. In the first nine months of 2021, its revenue rose 2% year-over-year to $29.3 billion as its adjusted EPS increased 18%.

Oracle's revenue rose throughout all three quarters as higher demand for its cloud services -- especially its Fusion and NetSuite ERP (enterprise resourcing planning) services -- offset the pandemic's impact on its on-premise software business.

Analysts expect Oracle's revenue and earnings to rise 3% and 16%, respectively, this year. The company consistently generates stronger earnings growth than IBM because it repurchases a lot more shares every year:

IBM Stock Buybacks (TTM) Chart

Source: YCharts

IBM bought back fewer shares to conserve its cash for cloud-oriented acquisitions, but Oracle consistently repurchased its shares while expanding its cloud business. Over the past five years, IBM's share count remained roughly the same as Oracle's share count declined by over 16%.

Both stocks are cheap, but one is a better value

IBM trades at 12 times forward earnings and pays a forward dividend yield of 4.5%. After its spin-off, it plans to pay a comparable yield for investors who hold on to both stocks -- which suggests the "new" IBM could pay a lower dividend on its own.

Oracle trades at 16 times forward earnings and pays a forward yield of 1.7%. Oracle's dividend is lower, but that's because it spends most of its free cash flow on buybacks instead of dividends.

IBM's low valuation and high yield might limit its downside potential, but its path forward remains murkier than Oracle's. IBM still needs to generate consistent growth again by expanding its hybrid cloud and AI businesses -- but that could be challenging as other cloud giants eye the same markets.

Oracle's growth is more stable, and it will continue to tighten up its valuations and boost its earnings per share with big buybacks. Those strengths all suggest it will outperform IBM over the next few years.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.