Well, at least in the US many PhDs have one only because it is the easiest way to immigrate to the country. The majority of CS PhDs are foreigners. It's easier than finding a job and getting a work visa. PhD is usually fully funded and tuition is waived. Unlike Masters which most international students cannot afford since financial aid is rare.