It’s no secret that Yahoo’s biggest asset—its stake in Chinese company Alibaba—has also been its biggest albatross, saddling the Silicon Valley firm with a potentially massive tax payment. But reports that Verizon is interested in buying Yahoo show a way that could make that tax bill go away altogether.

Yahoo yhoo scrapped plans in December to spin off its 384 million Alibaba shares into a separate company because of the chance that it could be stuck owing capital gains taxes of as much as $10 to $12 billion. Instead, Yahoo said that it would seek to sell its own core business in a tax-free transaction. Yet even that transaction would likely generate a tax bill, though likely a smaller one. Even so, investors have continued to value Yahoo as though it could still be forced to pay through the nose on its Alibaba baba stock gains.

But there is a way that Yahoo could avoid paying taxes on Alibaba all together. It’s a complex scenario, but one that’s becoming increasingly plausible.

Over the weekend, Verizon vz CEO Lowell McAdam told CNBC that he could envision acquiring Yahoo, saying that “marrying up some of their assets” with Verizon’s recently acquired AOL business “would be a good thing for investors.” The Yahoo assets that are attractive to Verizon most certainly do not include the Alibaba shares, according to accountant and tax advisor Robert Willens, who runs his own firm. That means Verizon would not inherit the Alibaba tax liability. Rather, Verizon would likely buy Yahoo’s core business for about $5 billion, Willens estimates. The “rump” of Yahoo—a shell company composed of the Alibaba shares and a separate chunk of Yahoo Japan—would owe minimal taxes of about $800 million on the sale, also according to Willens.

In this scenario, you might think that the remaining Yahoo shell still has the problem of owning Alibaba shares that it can’t sell without having to pay a big tax bill. But there is one exception: Alibaba could buy Yahoo’s remains—which would essentially be a “a free [share] buyback for ‘Baba,” Willens says. That way, Yahoo shareholders would exchange their shares for direct holdings of Alibaba (and perhaps an extra bonus of $6 to $7 per share in cash, Willens estimates). “The end game is to have ‘Baba acquire Yahoo—that’s the key to it,” he says. “The only company that can buy Yahoo and eliminate that tax liability forever is ‘Baba.”

Alibaba, meanwhile, could retire the shares that Yahoo held thereby reducing its own share count and increasing earnings per share.

As for the Yahoo Japan stake—the only other entity under the Yahoo umbrella besides its core business and the Alibaba stake—Willens thinks Yahoo could also dispose of it without paying the IRS in a tax-free transaction known as a cash-rich split-off. Essentially, Yahoo would jettison its Yahoo Japan stake and cash proceeds from the sale of its core business into a small subsidiary formed by Yahoo Japan. Yahoo shareholders would then get stock in the new subsidiary in return. But since the new subsidiary is largely just cash, Yahoo shareholders would likely get much of that cash back via special dividends—washing their hands clean of Yahoo stock while circumventing any major tax punishment.

Between the various dividends and payouts that could be coming to Yahoo shareholders through the various transactions, it’s curious why the market is still discounting Yahoo stock as though it will be paying billions to Uncle Sam.

“Those taxes aren’t going to be paid,” says Willens.