Textbooks and Professors

Sometimes professors write textbooks, and sometimes these professors use their own textbooks in their courses, assuring plenty of book sales. Is this ethical?