@Stephen Oakes the ordinance isn't directly against students. The rule is that there cannot be more than 2 unrelated persons living in a single family zoned residence. Investors and tenants do get away with it sometimes but there are those who get caught and have to pay a hefty fine.
"Fines for these citations are up to $900 for the first offense, and each day may be considered a separate offense."
"The property owner and any agent of the property owner shall be legally responsible for directly or indirectly allowing, permitting, causing, or failing to prohibit the occupancy of a dwelling unit by more than two unrelated persons."
The link underneath gives the full details for the zoning ordinance...
http://www.sanmarcostx.gov/Modules/ShowDocument.aspx?documentid=1477
San Marcos isn't the only city to adopt this ordinance, but they are one of the few cities that actively pursue offenders. So check with each city that you plan to invest in. Look under zoning ordinances or laws. I'm not saying this to scare anyone from buying investment properties in this area, but do your due diligence by looking at zoning maps and verifying what ordinances they have on such zoning districts.