As a textbook author myself (I've written a couple of physics textbooks) perhaps my views in this area are a little "coloured" by self-interest

.
The main difference between textbooks and mass-market fiction is the size of print runs, and that's what makes them expensive. Very often only 2000 copies of a textbook might be printed, which would be a ludicrously small print run by fiction standards. That's why the unit costs are high, and textbooks are expensive.
Believe me, you aren't ever going to meet a wealthy textbook author

.