The best textbooks I used in uni were either free or extremely cheap (Linear Algebra done right comes to mind, it was 30-40$, and at least the most recent edition is completely free online. I can't remember if the edition that I bought had that option). More than once I had a professor who was in the process of drafting a textbook or had already written one and it was simply given to everyone in their section for free. Paying hundreds of dollars for intro mathematics books that were glorified collections of practice problems just to get access to the online homework was insulting compared to the care put into those texts some professors gave out for free.
I wouldn't expect every professor to write their own, but I think universities should at least work on some sort of in-house solution for the intro text problem that all the instructors could use, especially public ones. It is absurd that most of those courses are structured to gate homework grades behind an expensive purchase of what is usually a sub-par text.
>I wouldn't expect every professor to write their own
Wikibooks exists to allow people to collaboratively write textbooks, so every professor doesn't have to write the entire book https://en.wikibooks.org/wiki/Main_Page