While in practice no one will check in a lot of universities which have an otherwise open campus, so it is easy to sit in for classes, especially if they are large, technically most schools require some sort of registration. (OTOH, for most graduate level math classes an extra person is a noticeable increase in class size ).
But with the nice open courses and textbooks available these days, it is considerably easier to have access lectures and course materials from outstanding lecturers, eg MIT OCW.