I had a professor, way back in the early 00s, who was helping solve this problem. We had no textbook in the class. Instead, our readings were all recently published papers. On the class website he linked to all the papers so we could download and print them if we wanted to. He also negotiated with the author of each paper for the rights to reprint the paper. You could buy the "textbook", which was just a bound photocopy of the papers, for $10 (the cost of printing).
If more professors did this, then the problem would be solved.
I'm doing this with a class I'm teaching, but I think it works better for small research/discussion-oriented seminars than larger introductory courses, where recent papers are most relevant. For intro courses, coming up with good intro materials is a fairly hard problem. If I were teaching an intro course on theory of computation, for example, I would probably still use Michael Sipser's Theory of Computation, because it's good, and I don't think I would be likely able to put together an equally good replacement out of freely available materials. I would, though, try to make sure that the course didn't prevent students from using the previous edition (which is now available cheaply).
This would only apply to upper level classes. The thing about this, there can some specialized classes where reading source papers makes sense. But honestly, even for those classes, usually a good survey book can be better, more concise than the source papers. It depends. But I don't think this would make sense of Algebra or Calculus ... or probably any class besides more specialized ones. I mean, you could teach a Distributed Systems class with source papers; I think that would be OK but it would probably be good to have a textbook as a reference.