Well, maybe. But according to this article by Jack Stripling from Inside Higher Ed on April 7, 2010, a number of universities say it's an ethical breach or at least a conflict of interest. Here's a link to the full article:
http://www.insidehighered.com/news/2010/04/07/textbook
Here's a quote from the opening paragraph: "No one likes rising textbook prices, but the bills may be even more painful to pay when it looks like a professor is cashing in on students. That's the sentiment at George Mason University, where students are grumbling about a professor who requires students to buy a book she helped to write, highlighting an ongoing debate about faculty profiting off their pupils".
Some university administrations ban the practice altogether. In other cases faculty senates have banned or strongly discouraged faculty from profiting directly from their students. At least one author in the article was quoted as saying such practices were "ridiculous".
"Ridiculous or not", the article goes on to say, "some universities have adopted far-reaching policies in recent years that are designed to ensure conflicts of interest don’t arise from textbook assignments. At the University of Kansas, for instance, professors are required to donate any royalties made off their students to their departments, schools, scholarship funds or other nonprofit groups. It is up to faculty, however, to calculate the royalties they believe came from their classes and make the requisite donations.
"Lisa Wolf-Wendel, Faculty Senate president at Kansas, said the textbook policy strikes the right balance between encouraging ethical behavior and not being heavy-handed with faculty who are encouraged to publish.
“I think this is sort of the most honorable way to do it,” said Wolf-Wendel, a professor of higher education. “There’s sort of an ethic to it that feels right to me. It’s an on-your-honor thing, so you decide how much profit you get back.”
I agree.