Goldman Sachs ( GS) is raking in at least $40 million for advising on the $18.7 billion buyout of radio station chain Clear Channel ( CCU). That's not too shabby for about three months worth of work.

But the deal payout for Wall Street's premier investment firm could have been even bigger, a recent regulatory filing shows.

Goldman Sachs twice tried to emerge as the primary financier for the big leveraged buyout, even though it was hired by Clear Channel in August to advise the company on finding a private equity buyer. The filing says Goldman Sachs offered to put together a debt financing package "to facilitate the sale process, noting that no buying group would be obligated to use Goldman Sachs as its debt financing source.''

The first time Goldman Sachs raised the idea of putting together a financing package for the four groups of buyout firms that were eyeing the company was on Sept. 25. Clear Channel's outside directors rejected the idea, fearing it could pose a conflict of interest.

But as the initial Nov. 10 deadline for selecting a buyer grew closer, Clear Channel's board changed its mind in late October and gave Goldman Sachs the green light to approach the buyers, providing it "offered the same package of debt financing to each consortium.''

With the buyout firms looking to issue more than $20 billion in new debt to pay for the deal, Goldman Sachs had the potential to make tens of millions of dollars more in bond underwriting fees. In the end, Goldman Sachs wasn't included in the group of banks that will provide financing for the deal. But the behind-the-scenes maneuvering by Goldman Sachs reveals some of the hardball tactics Wall Street's top players are using to maximize their profits in the red-hot LBO market.

On Wall Street this type of pre-packaged financing for an LBO is sometimes referred to as stapled financing. In the past two years, it's become increasingly common for investment firms serving as an advisor to a company to put together a financing package, in order to demonstrate to prospective buyers the ease with which financing could be lined up. But some say the situation is fraught with potential conflicts of interest.

Either way, stapled financing is another indication of how Wall Street firms are not just content with making fees from serving as advisors on such buyouts. Not only are investment firms also investing directly in deals they advise on; they also are grabbing some of the fees that come from underwriting the massive amounts of debt needed to put these takeovers together.

Thomas H. Lee Partners and Bain Capital -- the two buyout firms that emerged as the victors in the Clear Channel sweepstakes on Nov. 16 -- ultimately got $21.5 billion in debt financing from a slew of other banks. The Wall Street banks backing that debt package include Citigroup ( C), Morgan Stanley ( MS), Wachovia ( WB) and Deutsche Bank ( DB).

In all, the Clear Channel deal, in which investors will receive $37.60 a share, is valued at $26.7 billion, including the company's existing debt. The takeover is one of the largest this year and the fourth-largest LBO in U.S. history.

The Clear Channel regulatory filing, which was filed on Dec. 15, also sheds light on the back-and-forth bidding process for the radio station. The filing reveals that the company hired Goldman in mid-August to begin looking for a possible buyer, or consider a possible spin-off of some of the companies assets.

A week later, Clear Channel was approached by a private equity consortium led by Blackstone Group and Providence Equity. Initially, the company and the controlling Mays family seemed mainly intent on doing a deal with Blackstone and Providence. In mid-October, it rebuffed an inquiry from Thomas H. Lee Partners, fearing the "possibility of a leak, as well as the distraction to the Company's management...that could arise by engaging in discussions with multiple parties.''

Ultimately, Clear Channel's board invited T.H. Lee Partners and its group to submit a bid, after determining that the Blackstone/Providence group's bid was too low and undervalued the company. The initial bid for Clear Channel came in at $34.50 from the Blackstone and Providence group -- some $3 below the final price.

Other buyout consortiums that took a look at Clear Channel included one fronted by Apollo Management and the Carlyle Group, and a group led by Cerberus Capital. But those buyout firms never got as advanced in the process as the Blackstone or T.H. Lee groups.

At one time, Texas Pacific, another large private equity firm that has made a number of large transactions the past few months, was part of the group led by T.H. Lee and Bain that ultimately won. But Texas Pacific begged out of the process before the bid was awarded.

Clear Channel decided to go public with the sale process in late October, after speculation about a possible deal surfaced in the media. But by that time, the process already was well underway, the regulatory filing shows.

More from Stocks

PayPal Says It's Testing a Venmo Debit Card

PayPal Says It's Testing a Venmo Debit Card

Canopy Growth: First Cannabis Firm on the NYSE Fails to Generate Buzz

Canopy Growth: First Cannabis Firm on the NYSE Fails to Generate Buzz

Complying With Europe's New Data Rules Could Be Costly for Facebook, Google

Complying With Europe's New Data Rules Could Be Costly for Facebook, Google

Dow Tumbles as Trump Calls Off North Korea Summit

Dow Tumbles as Trump Calls Off North Korea Summit

Jim Cramer: Why I am So Bullish on Apple's Services Revenue

Jim Cramer: Why I am So Bullish on Apple's Services Revenue