Applicants to graduate studies in Computer Science must apply either to the MS program or to the Ph.D. program, and not to both.
The MS program is excellent preparation for a career as a computer professional, or for future entry into a Ph.D. program at Stanford or elsewhere. Individual programs can be structured to consist entirely of coursework or to involve some research. For students more interested in research, an option for an "MS degree with distinction in research" has recently been added (see https://web.stanford.edu/dept/registrar/bulletin1112/5254.htm)
The Ph.D. program is a top-ranked research-oriented program, usually completed in 4-6 years. There are very few course requirements, and the emphasis is on preparation for a career in Computer Science research.
Admission to the Ph.D. program is much more competitive than to the MS program, so students interested primarily in a Masters degree should apply to the MS program.
Every year a number of students from the CS Masters program apply to enter the Ph.D. program, and a small fraction of those students are accepted. Entering the MS program is by no means a guaranteed path to a Ph.D. at Stanford, and subsequent admission into the Ph.D. program is far from assured. However, very strong students with insufficient background for Ph.D. admission may choose to enter the MS program to gain additional experience, to demonstrate academic potential at Stanford, and perhaps to align with a faculty member in research. All of these factors, particularly the last, can contribute to a strengthened application to a Ph.D. program at Stanford or elsewhere.