Snap Inc.'s (SNAP 2.22%) IPO was a hit on Thursday, pricing at $17 per share and skyrocketing 44% to $24.48 per share by market close. In an instant, founders Evan Spiegel and Bobby Murphy raked in around $272 million in cash and still hold some $5.2 billion in shares of the company at the closing price.

Countless other early investors and employees cashed in as well, and are now holding millions in shares of the company. But the biggest winner may really be lead underwriters Morgan Stanley (MS -0.28%) and Goldman Sachs (GS 0.48%), along with partner underwriters like JP Morgan Chase (JPM 0.77%), Deutsche Bank (DB -0.78%), Barclays, and others. These banks made millions without the drudgery of having to build a company from scratch. Here's how the bankers made out like bandits last week. 

Image of Snap's logo.

Image source: Snap, Inc.

How Wall Street makes millions on IPOs

When an IPO takes place, banks have a lot of control over the process. They get to choose where the shares go and who pays the $17 price I mentioned above. You can't just open a brokerage account and get shares at the IPO price -- hedge funds, mutual funds, and other large investors are the preferred clients of the underwriting banks. And banks make millions in fees as well.

The first cut banks take is the commission they get for the IPO. Snap didn't take home $2.465 billion ($17 per share times 145 million shares sold by the company, with another 55 million shares sold by insiders); it will take home something less after the underwriting commission. We don't have the final number yet, but the fees disclosed indicate that bankers will get about $85 million, or 2.5%, of the base 200 million share offering. That's a nice payday, but it's actually lower than a typical IPO fee because banks were fighting hard for one of the few high profile IPOs expected in 2017. But that fee isn't where the real money is and it's not why Wall Street won the Snap IPO.  

The real money is made in what's called the overallotment. Bankers are usually given an option to purchase 15% more shares than the base offering in what's called an overallotment option. In this case, underwriters can exercise an overallotment of 30 million shares for as long as 30 days and they'll pay the $17 IPO price. Shares closed Thursday at $24.48 per share, so at that price Wall Street bankers have the option to buy shares for $17 and turn around and sell them for $24.48 on the open market. They could pocket $224.4 million just based on the opening day pop in shares. 

Why IPOs always jump on opening day

You'll notice here that with the overallotment option and the fact that banks are selling IPO shares to their favorite clients, they have an incentive to set the IPO price lower than where they think shares will trade on opening day. In a big IPO like Snap, they have hundreds of millions of dollars in incentive to underprice the offering. 

The phenomenon has been going on for decades and has been well researched by academics. New York Times' Dealbook wrote in 2011, "Over the last 50 years, IPO's in the United States have been underpriced by 16.8% on average." Studies show the phenomenon can also be seen worldwide. 

IPOs are big business on Wall Street, and if the underwriters play their cards right they can win big. That's what happened with Snap's IPO on Thursday and while Evan Spiegel and Bobby Murphy cashed in on the IPO after spending years building Snap into the company it is today, bankers made hundreds of millions just by winning the right to take the company public.