When I complete the PhD, if I go to industry in the USA, my income will probably be similar to that of my friends who will have been in industry the entire time (and gotten steady wage increases throughout).
It's important to note also cost of living. 40k/yr might sound like a lot, but in Boston, rent is >1k/month even with roommates, we don't have dental care, our health insurance is imperfect, groceries are expensive, etc. etc. Meanwhile in Tucson Arizona or Bloomington Indiana the stipend is something like 22-28K/yr, as cost of living is lower.
Generally speaking it's reasonable to say that completing a PhD in computer science is not a financial investment, but rather, something I am doing because I want to do it. I am very unlikely to literally "profit" (compared to, if I had gone straight to industry instead).
I hope this information is useful/interesting!
The work/life balance part is a bit trickier to quantify. Anecdotally US postdocs work pretty hard, but my experience is that highly paid engineers at FAANG-style companies also work pretty hard. If you don't want work to be your life as a SWE $250k seems to be the easiest achievable comp while meeting those requirements.
CS is certainly an outlier in terms of salaries, but ANY person capable of landing a postdoc in a STEM field at a competitive school in the US is capable of figuring out a way to get a job as a software engineer in Big Tech (the grind of leet code is nothing compared to the grind of doing a PhD, full stop). This is why >60% of PhD grads in CS across top schools are ending up in industry, and I knew a TON of PhDs from physics, math, chemistry, etc. who left research immediately after graduating and are now SWE.
Where do you get these numbers from? This is not at all like that in Europe. A postdoc gets (say, in France) 30k per year, doing a calm, interesting job and paid travel to a couple of conferences per year, with almost total freedom to choose their daily schedule. This is not a high salary, but it is certainly livable and quite above the median of the country. A 150k salary is nearly out of reach for even quite senior developers, and nonsensical for "junior python developer roles".