Just a few business related idea.
There are many considerations that factor into how a company sets its prices. For one, companies factor their total overhead into their cost of goods sold and develop their markups and margins from there. They consider their cost of holding inventory, but this is passed along in their cost of goods sold. Some product will turn over faster than expected while others stay on the shelf space longer than others. The trick is finding where the balance is. Also, a company can manage their inventory using FIFO (first in first out) or LIFO (last in first out) accounting methods. There are a number of different benefits associated with the use of each methods.
Also, some companies are factory direct with manufacturers that other stores have to use a distributor for. Most of the time, the high volume sellers that operate online are factory direct with manufactures and maintain large open accounts so they can get product cheaper.
Another consideration is the efficiency of the company's logistics and supply chain. An online retailer will have higher transportation costs as they will have far more frequent shipments made through 3rd party package carriers. But again, this is an added cost that may be offset that the lower prices they pay for higher volume orders and possibly less overhead to have to factor into their COGS.
Some companies with efficient supply chains are also capable of reducing their inventory costs by effectively employing Just in Time inventory methods. Like the name suggests, Just in Time inventory is the idea that inventory can be ordered as needed and arrive just in time for it to be sent to the customer, so that it spends a little time as possible being held in inventory.
Bottom line, business operates across a number of different competencies with a number of different processes. The way to minimize one's own operating costs, thus minimizing the prices that have to be pass on the consumer, depends entirely on how efficiently and effectively a company is able to operate.