If not, then you have a situation like, suppose I'm a Mexican farmer and I can sell bananas to the US for $1.99 a pound, or to Canada for $1.25 a pound because there are price controls in Canada and they're not allowed to pay more than that. Why would I bother selling bananas to Canadians?
It's hard to control the economy like that because markets are self-regulating systems. Even if Canada controlled its entire supply of food, there are things Canada can't control, such as the price of fertilizer and farm equipment. If you put price controls on food and it's no longer economical to buy farming equipment and supplies anymore, you also end up with food shortages.
A hundred years of global commercialization has proven the "self-regulating systems" idea complete garbage. We've seen food prices increase across the US and Canada far outpacing inflation under the guise of "supply chain constraints", while those same global industries are cutting workers and seeing record profit.
There is one fairly straightforward solution for housing, at least: lots of public housing. Ideally, modeled on successful public housing policies from places like Singapore or Vienna.
Getting lots of public housing would probably involve a lot of things that YIMBY's push for private housing too; you'd still want upzoning, you'd still want to get rid of processes that let neighbors stop developments for anything they want (eg. "it's not okay that this tall building will cast shadows"), you'd still need to get planning commission to process permits on the order of days or weeks rather than months and years, etc.