Prices for scholarly books are not set by the author but by the publisher. The author will often send you a PDF for free if you email and ask nicely.
The academic book publishing industry is very predatory, which is why so many authors nowadays support open textbook initiatives.
What I can say with certainty is that in many poorer countries scientific research would be impossible without piracy. Universities just don't have the budgets and libraries are often abysmal (unless you work in the capital and it has a prestige state library).