Yahoo rakes in another jackpot from Alibaba's IPO

Yahoo's Alibaba stake by the numbers
Yahoo's Alibaba stake by the numbers   

Yahoo is making amends for years of blundering with one smart move: an early investment in China's Alibaba Group that has turned into a multibillion-dollar boon.

The latest windfall will be delivered with Alibaba's record-setting IPO completed late Thursday, which is expected raise up to $25 billion for the e-commerce company and its early backers. The company's shares will begin trading for the first time on Friday on the New York Stock Exchange.

Read MoreLive Blog: Alibaba, the biggest IPO ever

Yahoo is in line to make anywhere from $8.3 billion to $9.5 billion from the initial public offering, depending on whether investment bankers exercise their right to buy additional stock in the deal. The payoff supplements the $7.6 billion jackpot that Yahoo collected two years ago after selling another chunk of its Alibaba holdings and reworked a licensing agreement with the Chinese company.

Hector Mata | AFP | Getty Images

Even if Yahoo ends up selling its maximum allotment of 140 million shares in the IPO, the Sunnyvale, California, company will still retain a roughly 16 percent stake in Alibaba worth another $26 billion to $27 billion.

Not a bad return, considering Yahoo acquired its Alibaba stake for $1 billion in 2005 in a deal engineered by company co-founder Jerry Yang and former CEO Terry Semel.

Read MoreAlibaba prices IPO at $68 a share

The Alibaba investment has helped ease the pain of Yahoo's struggles in Internet advertising, the heart of its business. Yahoo's annual revenue has slipped from a peak of $7.2 billion to projected $4.5 billion this year, a decline of nearly 40 percent.

The downturn has occurred even as advertisers steadily shift more of their budgets to the Internet and mobile devices, but most of that money is flowing to Yahoo rivals such as Google and Facebook—companies that have built more compelling digital services.

Yahoo has gone through seven different CEOs since 2006, including current leader Marissa Mayer, trying to figure out how to rejuvenate its growth.

Yahoo's Alibaba's cash
Yahoo's Alibaba's cash   

Wall Street's exasperation with Yahoo's financial malaise caused the company's stock to sink below $9 in late 2008. The company's stock is now hovering around $43, a level that hasn't been touched since 2006. Most of the comeback occurred during the last two years as investors latched on to Yahoo's stock to profit from Alibaba's success leading up to the IPO.

Read MoreThree things that could go wrong with Alibaba IPO

Yahoo now must decide what to do with the money that will pour in from Alibaba's IPO. Mayer has promised that at least half the amount, after taxes, will be returned to shareholders through dividends or, more likely, buying back stock. That leaves open the possibility that Yahoo might use the rest of the money from the Alibaba IPO to help finance an acquisition of another Internet company such as AOL or a hot startup such as social media company Pinterest in its latest attempt to revive its business.

(Disclosure: CNBC has a content-sharing partnership with Yahoo's finance site.)

By The Associated Press