Warren Buffett, chairman and CEO of Berkshire Hathaway (BRK.A -0.22%) (BRK.B 0.04%) has been managing investments for his company for roughly 60 years. For much of that time, he largely avoided trading in technology stocks, once stating:

Technology is based on change; and change is really the enemy of the investor. Change is more rapid and unpredictable in technology relative to the broader economy. To me, all technology sectors look like 7-foot hurdles.

But there are always exceptions to the rule, and Berkshire Hathaway started buying Apple (AAPL 0.04%) stock in 2016 and invested in Amazon (AMZN 2.66%) beginning in 2019. These are two of the world's largest tech companies. Let's take a look at Buffett's seeming contradiction and maybe also determine whether these two blue chip stocks might fit into your portfolio.

Warren Buffett talks to media members.

Image source: The Motley Fool.

Amazon invests in innovation to prolong its strong growth

Berkshire's stake in Amazon is a relatively small position in its nearly $285 billion stock portfolio (about 0.8%), valued at approximately $2.2 billion. It's likely that it was initially purchased in 2019 by one of Buffett's lieutenants. Nonetheless, Buffett has previously joked that he was "an idiot for not buying" the stock sooner.

Amazon's stock price has struggled of late, down about 1% so far in 2025 as it ramps up its capital expenditures to keep up in the artificial intelligence (AI) arms race. Amazon CFO Brian Olsavsky said capital expenditures could exceed $100 billion in 2025, driven by investments in data centers, chips, and AI infrastructure. That expense is up significantly from $48.1 billion in 2023 and $77.7 billion in 2024, reflecting the importance management puts on AI.

While the return on investment for AI may take a few years to materialize, Amazon continues to deliver results now. In Q1 2025, Amazon generated $155.7 billion in revenue, a 9% year-over-year increase. As for profitability, one metric Buffett prefers is operating earnings, a measure of a company's direct profits from its core operations that exclude volatile unrealized capital gains and losses resulting from its investments. Amazon delivered $18.4 billion in operating earnings for the quarter, representing year-over-year growth of 20.3%.

One area where Amazon's AI return on investment is already showing up is in its Amazon Web Services (AWS) division. Specifically, management projected a $117 billion annual revenue run rate for AWS in 2025, with its Q1 increasing 17% year over year to $29.3 billion. CEO Andy Jassy underscored the growth on the company's most recent earnings call, saying: "Before this generation of AI, we thought AWS had the chance to ultimately be a multi $100 billion revenue run rate business. We now think it could be even larger."

AMZN PE Ratio Chart

Data by YCharts.

Beyond its earnings growth, the balance sheet is in tremendous shape, with $41.2 billion in net cash. And as for Amazon's valuation, its stock looks undervalued compared to its historical averages. Specifically, Amazon stock trades at 34 times trailing earnings, close to a five-year low and well below its five-year median of 65 times trailing earnings.

Put it all together, and Amazon is the rare company that isn't afraid to invest in innovation to prolong its growth phase. It can afford to do so with a strong cash position and consistent earnings growth, making it a perfect buy-and-hold candidate for your portfolio.

2. Apple

Berkshire Hathaway first bought Apple stock in 2016, and despite trimming the position beginning in 2024, it remains the company's largest holding by far (21.2% of the portfolio). At the end of Q1 2025, Berkshire still owned over 300 million shares, worth north of $60 billion. Buffett has previously noted Apple is a "better business than any other we own [outright]."

In many ways, Apple checks every box for Buffett: iconic brand, loyal customers, and enormous cash generation. In its most recent quarter, its fiscal second quarter ended March 29, 2025, Apple generated $90.8 billion in revenue and $29.6 billion in operating income, year-over-year increases of 5% and 6%, respectively. Notably, revenue for the company's flagship product, the iPhone, only grew 2% year over year to $46.8 billion after the company faced a decline in the segment during its fiscal Q1 2025.

While Apple isn't spending as much proportionately as its peers on AI, it isn't ignoring it either. The company developed Apple Intelligence, a free, built-in AI system for its products, which CEO Tim Cook said in a 2024 earnings call "will transform how users interact with technology."

It could also boost its iPhone sales, considering the technology is only available on Apple's relatively newer hardware models, which may prompt more consumers to upgrade from their current devices. Apple hasn't broken out exact figures, but Cook recently noted that markets where the company rolled out Apple Intelligence saw "stronger" performance than those that hadn't.

AAPL Shares Outstanding Chart

Data by YCharts.

As investors wait to see demand for Apple Intelligence develop, Apple rewards shareholders through continued share repurchases and dividends. In just the past five years, Apple has reduced its share count by nearly 13%, and more recently announced a $100 billion addition to its share repurchasing program. Buffett has called buybacks a way to benefit all owners, provided they're done at attractive valuations. "The math isn't complicated: When the share count goes down, your interest in our many businesses goes up," he said in a 2022 letter to shareholders. "Every small bit helps if repurchases are made at value-accretive prices."

Additionally, management has consistently paid and raised its dividend for 14 consecutive years. Today, the company pays a quarterly dividend of $0.26 per share, equating to an annual yield of 0.5%. Moreover, considering its payout ratio -- the percentage of earnings paid out as dividends -- is a lowly 16%, investors can reasonably expect annual dividend hikes for the foreseeable future.

AAPL PE Ratio Chart

Data by YCharts.

Finally, despite the stock's recent decline of roughly 18% in 2025, it trades at 31 times its trailing earnings, slightly above its five-year median of 29 times. While that may give some investors pause, Apple's track record of innovation, shareholder returns, and support from Warren Buffett make a compelling case. For long-term investors concerned about valuation, dollar-cost averaging offers a disciplined way to build a position in one of the most iconic public companies ever.