It's pretty simple really if you think about it.
Blizzard sells directly to customers from their site, however they also sell to retailers. They will get far more money from the retailers than they do directly from customers, because stores will buy copies of Diablo III in bulk and after that Blizzard just have their money regardless of whether the purchased copies are bought from the store shelves or not.
The retailers pay less than customers do because otherwise the retailers would make no profit and thus wouldn't bother buying the game to resell, so they probably pay something in the region of $30 to sell at $40.
Now, Blizzard also want to sell the game themselves, but if they price it at less than what retailers are offering then the retailers will stop buying hard copies from them because everyone would buy it online as it would be both cheaper and more convenient. The digital version's price is kept high because otherwise there would be no hard copies at all, and that is where a great deal of Blizzard's income comes from.
It is fairly confusing for the customer, yes, but while a physical market still exists then it is really the only way to operate.