You still pay that cost with your wallet, it's just hidden from you when you look at your code.
The main monetary benefit of serverless is that you can truly scale down to 0 when your service is unused. Of course, writing a nice self-contained library that fits into your monolith has the same benefit.