I’ve also seen professors who get kickbacks from the sale of textbooks up to and including professors making their own textbook that they authored a required text for the course.
Nobody is getting rich by writing a textbook. The most likely reason for using a book they wrote is that it includes information they thought was important.
In the US states have reduced their funding for public colleges shifting the burden to students. On top of that universities have more programs and features than they used to. The university I was at constantly operated at a loss.