Good question. It's a science of its own, I'm afraid.
Production costs is just one factor of many.
Example: https://simple.wikipedia.org/wiki/Market_segmentation
As a radio tinkerer (CB, crystal radios etc), I drew the conclusion that most products sold today are intentionally "defective" fresh from factory and that we citizen have to fix them on our own before use.
Basically not too different like we had to fix stuff our radios and cars in ca. 1950 when living in a village or on the country side.
You have plastic gears that break, you have missing capacitors (empty spots on PCB),
diodes that are too weak, electro motor that burn or have poor bearings etc.
The sad or ironic thing is that military/maritime equipment is about the only thing that's still "normal" in terms of quality (radio transceivers etc).
Or that'show it used to be. Nowadays, that stuff perhaps nolonger is as rugged as it used to be.
(In my country, the "military" basically orders cheap plastic stuff that doesn't work correctly - but hey, it's modern!
There had been news about it in the past months/years,
it was about new digital radio transceivers that are supposed to replace the old SEM 80/90 models.)
In computing, industrial and server products are usually of higher quality, still.
But even here, plastic materials and cheap consumer technology (USB, HDMI, Twisted Pair network cabling) is on the rise, trying to replace things like RS-232/RS-422/RS-485, VGA, Arcnet etc.
And that's bad. Old industrial interfaces had galvanic insulation via opto-couplers, which isn't taken for granted with USB.
USB is cheap, there's no proper locking mechanism, it wears out fast etc
Speaking under correction, I'm just a layman here.
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel
//My video channel//