From the Bureau of Labor Statics, the median weekly pay for Bachelors, Masters, and Doctorate holders is $978, $1,228, and $1,555, respectively.2 While in school, Ph.D. students could hope to earn as much as $30,000 per year.3
The Social Security Administration believes that real stock-market returns will be 6.5% in the future4, although this is disputed, with others claiming returns of 4% are more realistic.5 We'll take the age of retirement as 65 years in all cases.
Finally, not everyone who enrolls in a Ph.D. program successfully completes it. We'll take a favorable completion rate of 58%6, and assume that those who fail take the same amount of time, ultimately receiving a Master's degree if they did not already have one, and nothing if they did.
That should be all the information we need. Let's first look at the scenario most favorable to getting a Ph.D. You're 23 years old and just finished your undergraduate education. You can work for the next 42 years for an average weekly salary of $978 in 2009 dollars ($50,856 annually). Alternatively, you can go to a Ph.D. program which does not require an intermediate Master's degree, finish after 6 years, and make $30,000 per year while in school, and then make $80,860 per year if you succeed, or $63,856 per year if you fail and receive only a Master's degree. At a 4%/year discount rate, the expected net present value of going for the Ph.D. is $1.31 million, compared to $1.07 million for staying with the Bachelor's, making the Ph.D. advantageous economically.
Now let's consider another scenario. You're 25 years old and already have a Master's degree. You could work immediately at $63,856 per year. Alternatively, you could spend another 6 years trying to get a Ph.D in a related field, at a $25,000 per year stipend, and then have a 58% chance of increasing your earnings to $80,856. With a 6.5% discount rate, the net present value of working immediately is expected $962,000; the expected value of getting the Ph.D. is $859,000 (and is still only $930,000 if we assume a 100% chance of successful completion).
Overall, it seems impossible to say that getting a Ph.D. either always or never pays for itself. Rather, it is marginal and depends on the individual situation, favoring younger people who do not already have a Master's degree, and can enroll in a program which does not require one and has a high completion rate.