Inertia/tradition accounts for many things. "Doing things they way they've always been done" [sic] is usually considered defensible, too. Also, people have already-existing mental models for what a lecture should be like, often including specifics about the subject matter.
The fact that information is available on-line is not wildly different from the fact that information was available in universities' libraries. Yes, a sufficiently motivated person can simply go to the internet/library and find lots of information. A potential problem is that there is too much information, that it is fundamentally chaotic (despite our attempts to impose order or develop "search engines"), and fundamentally hard for a non-expert to evaluate. Even worse, a non-expert may fail to realize that they are failing to correctly evaluate information. :)
Still, yes, very many classes/lectures are boring, and attendance is often easily replaced by reading the designated textbook or other sources. However, in several decades of observation, many students (at all levels) either prefer or have become accustomed to a kind of passivity, so that they'd rather show up somewhere at a regularly scheduled time, see their fellow students, and have the pace and content dictated to them by even a fairly boring lecturer.
In my own student days, I did not like going to classes, for the obvious sorts of reasons: for one thing, if one had read the book, a slo-mo flawed, re-recital of it seems pointless in comparison to just re-reading at one's own speed. Second, if one found the material interesting, why stop? Why not read ahead? Why not look at other sources, too, for complementary viewpoints? Why not look at related stuff? (This was as feasible in libraries as it is on the internet, with perhaps two added advantages: there really was not much junk in libraries, since it was filtered, and, second, the chances of serendipitous discoveries in libraries was larger than on the internet.) Such a process inevitably makes the "canned" lectures seem crazily irrelevant.
(Also, years ago, libraries were some of the few reliably air-conditioned places!)
But let's ignore the problem of student passivity, and ask why/how a lecture _could_be_ better than just reading a book or searching on the internet. Arguably, a lecture is not better if it just amounts to reading from the book, copying from it onto a blackboard, etc. I would claim that trying to make lectures simply present text-book material is a big mis-use of the medium! That is, systematic presentation of all the details belongs in a book or on-line, but not in a lecture. Oppositely, what could be in a lecture that could not be in a book or notes? "Affect", meaning intonation, gestures, facial expressions, theatrical effects, and so on, are hard to put into writing, but (by "lecturers" capable of it) can be put into a lecture. This includes reaction to facial expressions and body language of the audience/students, and conversational interaction if the group isn't too large. For example, lectures can include "pep talks" that would be hard to fit into writing. "Reassurance" can be done live better than in writing, I think.
Another feature is the "live/real-time" aspect: a lecturer (in mathematics, my field, for example) can literally do things in the lecture room, live, in real time, with voice-over narrative, in effect. That is, the audience can witness the genuine activity as exercised by an expert practitioner, with accompanying critical and methodological comments. Yes, up to a point, textbooks and monographs could be written in such a fashion, but it seems that stylistic pressures move them in the opposite direction, aiming for a sort of artificial perfection that can only be achieved by much editing! Too often it seems that writing aims to create impressive edifices rather than be accessible, helpful ... and a live lecturer can easily do better, if they try.
So, for my own lecturing, I definitely do think in terms of "adding value" beyond what students could derive from written sources, and in terms of using the medium in ways that distinguish it from static written sources (and not having a lecture be a bad re-copying of those written sources).