You practically have to have every bolt be traceable back to the ore the iron for the steel was smelted from (this is only a slight exaggeration). That puts a huge additional cost on every unit shipped. Software is not subject to that. You can certify it once and amortize the cost over a million copies sold. The cost of testing is also much cheaper.
It isn't just the cost of testing. The barrier to entry, no matter how modest, is not what increases the price so much. It's the pricing power acquired from the lack of competition, as the barrier prevents new entrants.
If three brands of GPS mapping device dominate the consumer market, but only one of them bothers to certify for aircraft, the exact same hardware in an aircraft dash-mount will cost many times the amount for a consumer handheld. Costs only determine prices for commodity suppliers. Everyone else charges what the market will bear.
Medical equipment is expensive for reasons other than just liability. Much of it is because of some combination of being quite specialized, protected by medical patent (or other IP law), produced from expensive materials or manufacturing process, and subject to all sorts of regulations involved in prolonging/saving lives.
You can get most medical equipment from China/India at up to 100x lower prices, but nobody would even dare to use them on any patient (in first world countries) because of the liabilities... and that's why customers only get products made by certified companies, who accept the liability and consequently tighten their manufacturing, and pay for whatever IP.
The same would happen with any other kind of software/hardware where liabilities are regulated. Suddenly companies would have to tighten their development processes, triple check for IP, formally verify every component, get certified and insured, and prices to the consumer would skyrocket.
There is already a kind of hardware and software where companies are liable: in medical equipment. Now look at what that does to the prices.
Open source and consumer serviceable makes sense, but that's already being fought for with the "right to repair" movement.