Well, first of all, a traditional student will be out by age 26-27 not 40. Secondly, PhD students in the sciences are paid. Not much, admittedly -- about $22k, on average -- but enough that you have positive cashflow.
That's true, although the average age for a scientist to land a tenure track position is in their late 30s, after several postdocs (where you are barely paid more than a graduate student). Ican't find the citation at the moment, but I believe it came from the NIH.
Postdocs nowadays tend to make something on the order of $50K (as compared to maybe $25K for a grad student). It's not big face money, but it's a big step up from grad student life.