Because words like "housing" and "houses" in conversational speech hides the fact that it has 2 major components: (1) land and (2) the building structure
The big part of rising housing prices or "scarce housing" or "demand exceeding supply" is really about desirable geographic locations.
Sure, raw materials prices like lumber and copper pipes go up in price too but it's also the rising land value that's contributing to the "return on investment". That's the component price that doesn't work like food commodities. My home is decades old and has outdated technology that today's brand new homes have upgraded but nevertheless, my so-called "house" has tripled in value because a new hospital down the street was built 10 years ago and all the doctors want to live in my neighborhood to have a short 10-minute commute. If someone actually bought my so-called "house", they may bulldoze it and rebuild a new more modern home on it.