They do have to make money, but
1. They don't need to make obscene quantities thereof. Calculus textbook AUTHORS (who make only a small percentage of the profits) rake it in big time (Stewart, of Stewart's calculus has a $20MM house in Toronto).
2. There are, in fact, perfectly good calculus textbooks which are in public domain (this may be less true of engineering books, since the field evolves faster). Why aren't they used? Your guess is as good as mine.
I thought profs can choose a text book they like. In one of my engineering classes, back in the day, our text was a dept prof's draft version.