While financial incentives is important to some, a lot of people write books to share their knowledge and give the book out for free. I think more people are doing this now, and there are also open collaborative textbook projects.
And I personally think that it is weird to write books during your working hour, and also get monet from selling that book.