My guess - and this is purely a guess - is it is because the volume sold is so low. To cover the cost of production plus a reasonable income for the author's time, it is very high. And because they are often written by the instructors themselves (or their friends), they can guarantee a certain amount of sales. On top of that, the school bookstore puts a larger markup on the books above and beyond the typical markup. I know this is a fact, because I used to go to the downtown Barnes & Noble to buy the exact same book our campus bookstore sold (which was also a Barnes & Noble store). The price difference was typically about $5-$20. Lastly, especially with technical books, the data becomes outdated so quickly, the lifespan of the book is relatively small. Therefore, you can not hit a critical mass to lower the cost as easily.
One solution I used as of my sophomore year in undergrad, is www.addall.com
. If it is published by a normal publisher (i.e. not internally published); they will tell you where the cheapest source is after shipping. It doesn't make it that much cheaper in some cases, but it is almost always significantly cheaper than the school bookstore. Moreover, if you have several books to buy, you can often save even more by consolidating the order to one vendor and save on shipping too.