Ripping off students through overpriced mandatory textbooks is not a worldwide phenomena. Through CS Bachelor and Master I too have never had to buy a coursebook. The few books that were needed for extremely standardized courses like math 1-3 were available in sufficient numbers in the library.
It takes two to force students to spend so much on books, a publisher can price their books anyway they like if there isnt a university forcing their students to use them. That for profit universities dont have a problem with that is not surprising.
It is entirely possible that your experience might be relevant for CS, I don't know I did a Physics degree, but there are a lot more degrees out there than CS or Physics, for which your experience might not be representative, in other words: There probably are degrees out there that do require the textbooks or if not actual requirement, it makes the learning experience better.
What is happening now is the publishers are providing a “service” that puts the homework assignments online.
That means you have to pay in order to do the required homework. Eg the books being in the library doesn’t mean you don’t have to pay the publisher. Similarly second hand books are closer to worthless because you still have to pay to have access to, and to submit, your homework.
I suspect legislation that requires the university to cover all fees required for assessment would end this nonsense in short order.
I take your point that if the e-books are available via the library, they will charge the library, probably on a pay as you go basis too
I'm only aware of it because my wife went back to school to completely change field (microbiology now, rather than software)