Why is Shimano 105 5700 (10-speed) is more expensive than 105 5800 (11-speed)?
Shimano, the distributor, and the retailer can pretty much set the price they want. It is common for older components to be more. 

Clearly the distributor and retailer are not going to take a loss.  

The marginal cost to Shimano is pretty low.  Most of the cost is R&amp;D, tooling, and branding.

Shimano wants you in their higher end stuff to promote their brand.

Once Shimano has machining set up the cost for them to produce one versus the other is the same.  And they may have some innovation that the new is actually cheaper to produce.