EDIT: Ebooks are a different case entirely, as they involve relatively little investment per copy and pay a pretty large percentage to the author.
It seems obvious that as HC costs more, the writer gets more -- but the difference is considerably greater than that, as royalty *RATES* are also different for each type of book. Taking some averages (not including Super Selling Authors, who get better rates), you can figure that for every HC copy of a book you buy, $3.00 of that is going to the author (taking about $30.00 as the price of the book). For every PAPERBACK you buy, about $0.50 is going to the author (assuming $8.00 as the price).
So while, yes, the hardcovers are expensive, I have to sell a **LOT** less of those to "earn out" my advance. If, for example, I got a $8k advance for GCA, to "earn out" that advance (and thus start getting more money coming in) I would need to sell about 2,700 hardcovers. To earn it out in paperback, I need to sell about 16,000 paperbacks. Back in the '70s, that would have been a very reasonable, perhaps even LOW, expectation for even a newbie SF author. These days, it's a much more challenging target.
The other number tracked by publishers is "sell-through". This is the percentage of books shipped which are actually sold. This is important because it is quite possible, if a publisher misjudges, for an author to "earn out" and even be owed quite substantial royalties on a book, while at the same time the publisher is losing money hand over fist. This happens if the publisher grossly overestimates the demand for a book (often due to the bookstores over-ordering). Imagine if they were to print, say, 100,000 copies of GCA, and 20,000 of them sold. This would not only earn me out, but would mean I have a nice $2,000 check owed me. Meanwhile, the publisher is having to EAT the cost of 80,000 copies returned.
Ideally you have high sell-through percentages, and large print runs, so that in both relative and absolute terms, you're doing well. A publisher can choose to hedge her bets somewhat by choosing a deliberately low first print run, and then calling for another run if sell-through looks very good. This costs her something in that the smaller print runs cost slightly more per book, but prevents her from risking a major loss on the excess books if the book really tanks.
_Digital Knight_ had a quite good sell-through of about 70%. John Ringo is a darling of Baen because HIS sell-through regularly tops 80% (I believe it's hit 90% or above on occasion). By the time you're at the 70% mark, you're actually losing a significant number of sales because enough of the books are sold that many locations DON'T HAVE IT and so people looking for the book can't find it. My collaborations with Eric have done well but there's no way to tell whether that was just his doing or partly mine as well.