What are merits of having a PhD degree?
You are asking why people might choose a doctoral candidacy over a better-paying job in the industry.
The straightforward answer is that - at least to the respective people - other factors are given more weight than achieving a maximum in payment alone.
These other factors can include:


freedom in choice of tasks
flexibility in working style
ownership of what you work on
autonomy in collaboration with internal and external partners
authority to draw further people in to your tasks
your colleagues are probably there because they're enthusiastic about what they're doing, not just because they want some job with an acceptable salary
your organisation probably covers a wide range of topics, and any acquisition of knowledge within (or sometimes even outsode of) your organisation can be reasonably counted as working time


Evidently, various of these aspects depend a bit on the concrete situation a doctoraĺ candidacy takes place in.

Lastly, even a payment angle can play into it: I consider it a significant advantage that during the time of my doctoral candidacy (this being a government-funded job), I used to be paid based upon a salary table with automatic raises rather than having to negotiate for any amount of money.