From what I understand, IPOs are very complex, but an ELI5 goes something like this: They want to open the stock to the public without crazy volatility in price, so there is a "pre-IPO" where brokers get access to buy it at $17, then $18, etc. and when people stop grabbing - they open it to the public. I think the underwriter basically buys all the stock for $17/share and then they broker it out to everyone, so anyone that buys over $17 is profit to GS. And GS assumes the risk that they priced it correctly and Snap is happy with $17/share so they're cool with GS profiting