Wal-Mart Wal-Mex

The Oracle of Omaha seems to be leaning away from Bentonville and toward Cupertino.

Warren Buffett’s Berkshire Hathaway Inc. sold off 15 million shares of Wal-Mart Stores Inc. in the second quarter, cutting its stake by 27 percent to 40.2 million shares worth $2.94 billion, according to regulatory filings late Monday.

Over the same three months ended June 30, Berkshire boosted its stake in Apple Inc., buying 5.4 million shares, bringing its stake in the iPhone maker to 15.2 million shares worth $1.46 billion.

The quirky billionaire is famous for buying and holding onto companies based on a simple premise like Wal-Mart, which buys at scale and drives down prices to sell goods to lower-income consumers.

Buffett started accumulating his investment in the discount giant in late 2005 and since the end of that year, the retailer’s stock has gained 56.7 percent (the issue dipped 0.4 percent on Monday).

While it’s difficult to draw direct conclusions from the portfolio shifts at Berkshire, in part because Buffett has brought on board other managers to handle some of the investing, the move from a seller of general merchandise to a seller of ultrapopular smartphones would seem to indicate broader general trends, from the rise of mobile to the increasing competition retailers of all stripes from Amazon.

Buffett has dipped in and out of the retail and fashion sectors over the years. The investment house holds a 315,400 shares of Procter & Gamble Co., worth about $26.7 million.

The company’s also bought and sold stakes in companies such as Nike Inc. and Seritage Growth Properties Inc., a real estate spin-off from Sears Holdings Corp. arranged by Buffett-admirer Edward S. Lampert.

Berkshire also bought underwear maker Fruit of the Loom out of bankruptcy in 2002 and continues to run the company.

Buffett, who has backed Hillary Clinton for president, has generally been bullish on the economy.

Late last year, he noted: “The interesting thing about the economy is you can give almost the same report ever since the fall of 2009. It really has been growing, is growing, at a couple percent a year, which is not bad. People have gotten more optimistic at times. They thought about a double-dip at times, then they thought it was accelerating.”