Warren Buffett has long preached the importance of investing in businesses that are hard for competitors to copy. That may be part of why his Berkshire Hathaway Inc. built a $520 million stake in Synchrony Financial during the second quarter.

The credit-card company, which was spun off by General Electric Co. two years ago, is a leader in issuing plastic under the brands of its retail partners. And like American Express Co., in which Berkshire is the biggest investor, Synchrony operates a payments network while also making loans.

“That’s something that’s difficult to replicate,” Arren Cyganovich, an analyst at DA Davidson & Co., said in a phone interview of the dual roles. “So if you’re thinking about the competitors in the retail and private-label card space, there aren’t too many that have the capabilities that Synchrony has.”

Another reason: A possible bargain. Synchrony slumped 18 percent this year through Monday’s close on concern about risks tied to swelling consumer debt. That could have provided Buffett’s company an opportunity to pick up the stock at attractive prices, said Cyganovich. Berkshire had 17.5 million shares as of June 30, according to a regulatory filing Monday.

Synchrony shares gained 4.4 percent to $30.95 in extended trading as of 5:02 p.m. in New York. Berkshire also has stakes in payments networks Mastercard Inc. and Visa Inc.

Berkshire also said in the filing that it exited its investment in Boston-based GE, which was worth more than $300 million as of March 31. He previously sold a large portion of his GE stake in 2012.

“The outlook for GE has certainly soured,” said David Kass, a professor at the University of Maryland’s Robert H. Smith School of Business, citing the recent departure of Jeff Immelt as chief executive officer. “The CEO essentially was forced to resign.”

Kass said Berkshire’s decision to sell GE and buy Synchrony in the same period was probably a coincidence. Buffett oversaw the GE holding, and one of his deputies — Todd Combs or Ted Weschler — was likely responsible for the new investment, given its smaller size in the Berkshire portfolio, Kass said. The filing doesn’t say which money manager is responsible for each pick.

Airlines, IBM

The filing also showed that Berkshire trimmed its stakes in American Airlines Group Inc., Delta Air Lines Inc. and United Continental Holdings Inc., while also exiting most of its investment in Wabco Holdings Inc., an auto-parts maker. Buffett’s company increased its investment in General Motors Co. to 60 million shares from 50 million and again added to its holding of Bank of New York Mellon Corp.

Some of the larger shares moves were previously disclosed, including reductions in the stakes of Wells Fargo & Co. and International Business Machines Corp.

Berkshire said in April it was selling about 9 million shares of Wells Fargo to avoid having a stake of more than 10 percent, a regulatory threshold that requires Federal Reserve review. Buffett had initially sought a waiver, but backed off after it became clear Berkshire would have to limit commercial activity with the bank to do so.

In May, the billionaire said that he’d misjudged IBM’s prospects and had sold about a third of his stake. The investment is a rare blemish on Buffett’s record. Beginning in 2011, he spent more than $13 billion buying shares, only to watch their value fall as the computer-services firm failed to boost sales. At the end of June, Berkshire’s holding was valued at about $8.3 billion.

The filing also showed a stake of about 18.6 million shares in Store Capital Corp., a real estate investment trust. That holding was disclosed in June.