You mean as opposed to pgm-class.online.stanford.edu? Well they're cheap, it makes the urls shorter, it's less confusing. Just good design. But too, I guess the ai-class is run by one of the teachers' startups, so it may be to separate them from Stanford, for that reason and to make it clear that you don't get Stanford credit.
From a SEO standpoint, it would make more sense to have them all hosted at stanford.edu/someclass, since the classes would then benefit from the "trust-factor" of the root domain. You'll notice that most of Google's web properties are hosted at google.com/something and not something.google.com or a separate domain, presumably for the same reason.
Consider: maps., docs., mail., plus., groups., translate., books., scholar. There are probably a bunch more -- I don't think Google is scared of subdomains.