It's also a lot of work, and can cost quite a bit. The author takes the risk, but reaps the benefit. Most self-publishers run out of gas and end up with a closet full of books. Substantial investment in equipment and expertise are needed to do this yourself. Book will probably make money, is unlikely to lose money.
Sales continue beyond break-even to give a steady stream of income.
The key is to publish books with enduring value and continuing sales. The publisher is selective, but can afford to produce books of value which may not fit mass-distribution channels. The publisher handles the mechanics, though you still are involved with promotion. Small startup expenses may be completely covered by the publisher if the book fits the publisher's interests. The publisher is invested in the success of the book.