A university offers a lot more than just classes--one of the primary functions is just to bring together lots of smart people. Being able to talk to both other students and professors face to face is important; and having plenty of other like-minded students around is great for more than just classes.
On top of this, universities also offer research. Being able to work on something exciting while you're there is important. And research benefits both from having a high concentration of smart people and having the appropriate facilities. (It also sometimes benefits from having a university full of guinea pigs :).)
Also, while most CS classes are easy to move online, this does not hold for other technical subjects which need equipment and labs. An online-only EE or Bio or Physics class cannot reproduce the hands-on experience which is very important to understanding the material well.