My impression is that a PhD in CS can be beneficial in industry, but the benefits generally derive more from the kind of work you get to do, not in the salary you earn. Some positions available "only" to PhD holders may allow you to bypass many of the unpleasantries in software engineering (technical whiteboard exams, SCRUM, limited autonomy, deadline pressures), but they don't necessarily pay more. And if you do go for the SWE position, a PhD won't keep you from having to go through the SWE hiring gauntlet.
I say this based mainly on personal experience and some browsing of positions and salaries with limited data. I'm a onetime doctoral student who left with a MS and went over to Sun Labs for a bit. Salary-wise, the newly minted PhDs didn't really earn much more than the newly minted MS students[1] - and almost certainly less if you compared them with MS holders who had spent the last 5 years working. But I did get put in giant due diligence projects where I had to recreate and verify ever SQL query in a giant operational software system, while the PhD researchers pursued more interesting projects with greater autonomy.
And if you're the sort who will burn out and decay to poor performance if you're bored, it could make a difference. We can compare MS to PhD generally across a population, but we can't really compare them for the same person. Fortunately for me, I actually like digging into long, complex, chaotic data pipelines, and if you find you enjoy something high impact and complicated that bores people, well then, that's not a bad way to get paid. But if you don't like it, that's a recipe for misery.
I believe, strongly, that we greatly overproduce PhDs, even in employable categories like CS (mainly because I think many of these CS PhDs would have found equally if not more fulfilling work at a potentially higher salary without the long years in grad school). Some people just need to do the PhD style work if they're going to succeed in life, and for them, more time in grad school combined with no clear financial advantage may hide a number of benefits they get from these jobs.
[1] one aside - salaries were notably lower for engineers and scientists in tech companies back then. This was back in the 1999/2000 - I was a grad student at Berkeley, and I was shocked by how much lower all engineering starting salaries were, at the MS and PhD level, than salaries out of the law and business schools, especially since the companies that were responsible for this pay disparity were lobbying congress fiercely to do something about this critical shortage of US citizens studying graduate engineering and science. My impression is that this gap has closed considerably since then.