I did have a professor that taught the class with the textbook he wrote. To prove that he believed in the book and not the revenue, he donated the royalties from our class from the book into the student fund.
Any professor who understands the first thing about marketing and adoption should do this. Jack Lee taught me smooth manifolds out of his own book that he gave to us for free. 10 years later, I'm teaching out of that book, so my students are paying for it.