To be fair though, a lot of publishers also do a one time payment deal with authors as well, after achieving a certain milestone of number of books sold.
The more common is an advance payment, but note that these are almost always offset against royalties, not in addition to royalties, and you need to be fairly successful before you'll ever earn out a full advance.
For 99%+ of authors, writing is a hobby that pays less than minimum wage. For self published authors it's often a net loss after costs like editors and cover design.