I've been writing for years, but before eReaders it wasn't really viable to go the traditional publisher route as they charged unknowns (the big publishers did anyway...) a fair amount at the time.
You've been misinformed. Vanity publishers charged writers. Trade publishers, publishers who sell to "the trade" (meaning bookstores, wholesalers and distributors) haven't charged writers for well over a hundred years.
This is what a trade publisher does:
Writers submit a query or a manuscript or both.
If the manuscript is accepted, the writer receives an advance; this may be a partial payment of the advance with the rest coming on final submission and/or publication.
The publisher pays editors, copyeditors, proofreaders, designers, typesetters, and artists to produce the final book.
The author works with the editors, proofers to produce the final ms.
The book is sent to the printer. If ebooks are being produced, the manuscript is "forked" so that a special version is sent to the printer, and another version is sent to ebook production to make various kinds of ebooks using different file formats for different devices.
The publisher's sales, marketing teams have already been working on selling the book to distributors, wholesalers, book stores and libraries, including finalizing release dates, selling the book, establishing review schedules by sending out ARCs, etc.
The book is available for advance orders.
The book is released.
The rest of the advance is paid.
People buy and read and review the book.
If it sells enough copies to "earn out" the author will a year or so after release, receive royalties quarterly.
But the author doesn't have to pay for editing, or book design or distribution or marketing.