It was interesting to see the breakdown of country of origin for students at my alma mater. The undergrad program was by and large Americans, the masters program mostly students from China and India, while the PhD program was roughly 50/50 students from China and the US. Sorting by price, the masters degree was by far the most expensive, undergrad was fairly pricey but with tons of financial aid available, while the Ph.D. students were all paid a stipend of 30K a year. At ~50K a year in tuition for the masters program, the CS department was making bank by inflating the size of masters cohort. Seemed kind of unfair to the masters students, from my perspective.