According to classical economic theory that's what a company should do provided (profit per unit) x (units sold) is maximised.
E.g. the iPhone has a relatively high margin, and it doesn't sufficiently affect sales to reduce Apple's overall profit too much it would seem. Other phone manufacturers at the lower end have slimmer margins as they cannot command a premium.
Obviously selling all products at a loss isn't a good idea, although companies sometimes do sell some things at a loss when trying to establish market share, the classic example being game apps on phone, where the free version has a cost to initially produce but the hope is that this loss leader creates sufficient network effects that people then step up to a higher margin version or use in-app purchasing. Also if you have a large capital investment in plant then selling some or all items at a loss for a period of time may make sense as ceasing to produce means that all revenue is lost, loans on buildings, or whatever, cannot be made and the capital investment is lost as a result. So for a bass manufacturer if the current cost if $101 then selling 500 at $99 is a $1000 loss, but producing none might mean $2000 of interest repayments cannot be made, so the rational short-term decision is to sell at $99 and hope conditions improve. Given the thin margins on some items this can happen as a small currency fluctuation can wipe out profits for a period in a particular foreign market (or equally might increase it) or input costs.
Even if the profit margin is healthy then reducing the input cost, if it doesn't lower quality unduly and impact reputation and sales, will increase it if the price commanded for the finished item can be maintained.