Warren Buffett and his team at Berkshire Hathaway (BRK.A 0.58%) (BRK.B 0.38%) have been nearly synonymous with Apple (AAPL 1.66%) since taking a position in the stock in 2014. The investment (and all the stock they bought along the way) turned out to be smart and made Berkshire a substantial profit.

However, Berkshire has started to sell Apple stock despite voicing its belief in the business. At one point, Apple made up more than half of Berkshire's investment portfolio; now, it has retreated to less than 40%.

So why is Berkshire reducing its stake in one of Buffett's favorite companies? The answer may surprise you.

Berkshire's unrealized gains in Apple are a big reason for its sales

Buffett is a value investor, but he's also one to hold on to a stock if it's winning. This is an excellent strategy, and it's one that many should emulate. However, there is one drawback: taxes.

If an investor has held a stock for more than a year, any profit they make is taxed at the long-term capital gains rate. For individual investors, this maxes out at 20%, depending on your income. For corporations, it's a flat 21%. This means that for every dollar in profit that Berkshire makes from Apple stock, $0.21 goes to the U.S. government.

In Berkshire Hathaway's annual meeting in 2024, Buffett mentioned that they don't mind paying taxes, but it sees the writing on the wall. Buffett mentioned that the rate was 35% not long ago and as high as 52% earlier in his career. After looking at the current political environment, he doesn't see those taxes decreasing, and most likely they will increase.

In the most recent State of the Union Address, President Joe Biden called for raising the corporate income tax rate to 28%, so Buffett's assessment seems valid.

As a result, Berkshire is taking action and capturing some of those gains before it's forced to pay higher taxes.

During the meeting, Buffett reiterated a few times that Apple would remain its largest holding even if it continued to sell stock. However, I don't think selling Apple stock is a bad idea, especially after the quarter it just posted.

Buffett may be selling for taxes, but you may want to sell for a different reason

Apple's business is not what it once was. Consumers aren't upgrading their products as often, and Apple has struggled to launch a new hit product. The Apple Vision Pro virtual reality headset, for example, isn't flying off the Apple Store shelves. iPhone sales are sliding, too. As a result, Apple's revenue fell from $94.8 billion in the second quarter of fiscal year 2023 to $90.8 billion (ending March 30) in FY 2024. This decline is just a continuation of a pattern that has been present since the start of 2023.

AAPL Revenue (Quarterly YoY Growth) Chart

AAPL Revenue (Quarterly YoY Growth) data by YCharts

Despite that, Apple has managed to improve its gross profit, which trickled down to the bottom line, and has kept earnings per share (EPS) flat compared to last year.

It's clear that Apple's core business (besides its services division) is struggling, but Apple's management is a world-class team, so the business' profits don't reflect these struggles.

Despite that, Apple's stock still trades for a premium valuation: 28 times forward earnings.

With the S&P 500 index trading at a much less pricey 21 times forward earnings, it's clear the market still holds Apple in high esteem.

I'm less convinced, and until Apple's core business starts improving, I don't want to be anywhere near the stock.