It is a combination of factors that lead to this, I will just give you a quick example, please note that I will not cover all factors.
* Product X is made by 3 companies in the US. It costs them $20 to make the product and it is sold for $30-33.
* Government increases minimum wage, which leads the cost to go up to $23 (e.g. cost of raw material is impacted, labor, etc), the producers increase the price to $33-35 while still taking a personal hit in their returns.
* Unexpected economic disruption or shortage in a certain raw material leads to increased costs to $25 and increased consumer price to $36-38
* Government implements a new legislation that impacts customer demand negatively and increases cost of production to $28. This leads to increased consumer price to $39-40
Throughout this process, supply/demand dictates that the increase in prices may impact negatively the demand for the good produced.
* One of the companies realize that it can produce the goods in a country called Melo for $5. It shifts a good portion of its production there, allowing it to sell the goods to consumers for $20.
* Customers sensitive to price will flock to the cheapest good. All the other companies decide to move their production to Melo country to remain competitive.
In part, consumers are willingly exchanging a few jobs here and there so that they can get goods & services at a cheaper price. Economics is full of trade-offs, understanding them is essential for a country's long-term success.