There are a few exceptions - Google is the most famous one. But they're rare, and even Google ran into trouble with theirs - they literally had to cut the size of the amount they raised in half about a week before the IPO, because the demand was lower than they thought, and then ended up leaving a lot money on the table.
We forget about all of that today because Google is now a successful public company. But their IPO was unambiguously a disaster from the company's perspective - they would have raised much more money with a conventional process.
> That's what I thought too, but someone from the investment banking industry corrected me the last time I said that, and pointed out that "banks never lose money", and that the company does eventually have to repay them.
No, that's not true. If the IPO is undersubscribed, the company isn't liable for making the bank whole. If that were true, then yes, there would be literally no reason for a company to use an underwriter, because there's no requirement to.