There are many factors affecting the investment in terms of finance, time and opportunity cost, as well as the possible return on said investment. Tom mentioned one that made sense—I'm not going to comment on the other thing he wrote.
I've answered the question purely based on my personal experience. Considering I had a great education and now have a pleasant situation I wouldn't have had without it, and seeing as I paid about $2000 a year in tuition for my BA, about ten times less for my MSc, and got paid decently to do my PhD, I'll say for me it's been a good investment.