I imagine in a world before the internet, this kind of thing was actually quite necessary. It would have been much harder to know any sort of details before booking a room in the night in a particular city (I don't know, I was born in 86). I'm guessing hotel regulations were written to maintain a baseline of quality, and regulations like the one this guy was fined under were written to keep people from getting around them.
Similar to the regulations on driving people around for money that Getaround and others are being fined for, to keep you from hailing a cab driven by a drunken, unlicensed cabbie.
At this point, though, it mainly seems that entrenched players like hotels and taxi companies are seeking rent.
I love the quote from the SF landlord at the end, celebrating the fact that infractions like these can be used to evict tenants and raise rents. We love you too, Ms. New.