>> The difference in you and your friend’s situation is caused by the fact that they are selling labor which has a much lower price than the labor you are selling. This is not contradictory, just a consequence of supply and demand.
I think the difference between labor and engineering is that most engineering (and software development) is a precursor to charging rent. Lets look a bit closer:
The marginal cost of software is zero. Therefore, every commercial software package is collecting rent for its use - SaaS being the most blatant (but honest) form. They will ostensibly be using the money to fund future versions of the software, but the efficiency of that effort is not terribly relevant - profits can be had, and high pay to developers.
In product design and manufacturing, the engineering effort goes into designing a product and plant to produce it. The key thing the business looks at is something like ROI (return on investment). Since the lifetime of a product isn't certain, anything that goes beyond the planned lifespan is pure profit. One could view the business as collecting rent on the equipment/process that makes the product.
At the highest level, investors are looking for a return on their investment. The investors don't actually have any part in the transaction between the company and its customers. Only when raising funds do investors bring anything to the table. After that, people trading stocks bring nothing and are looking for ROI. It's probably not correct to call ROI rent, but it's got some similarities.
So the low-end labor guy is getting paid to do work. All our fancy office jobs are building systems to generate revenue for someone. That may be the primary reason those jobs pay so much better. One is labor to an end customer, the other is labor to the money-making machine that is a large company ;-)
On a related tangent, perhaps engineering should not be considered a cost center but an investment.