Dunno about Maine, but unless you owned a house before the '80s, you don't buy a house in SF. If you do, you "buy" it with a mortgage that doesn't ever pay down any of the principal because ordinary people can't afford that. I moved to the other Portland in 2002 and rented a 500sf studio in the city for $495 a month. Around 2016, as I had decided it was time to leave, I learned that a friend was living in the same building. He was in one of the 395sf studios--and was paying $1300 a month for rent.
Bought a house on the outskirts of town in 2010. Paid substantially less than $100,000 for it. Sold it 7 years later for substantially more than $200,000. Moved to Kentucky because even though I had a job that was finally paying well, my work location moved, traffic had gotten horrible, and there were no places for sale within my price range. I could've barely afforded a vacant lot--and I don't like camping that much. Meanwhile, in Kentucky, I bought a house literally twice as large in every aspect--house, lot, garage--closer into the city and much nicer (complete with a gas fireplace) for half the price.
At the time, I had a few friends who were my age and experience level that were living paycheck to paycheck. I told them to get out and they all had some variation of "I like the weather" "all my family is here" "I just got a promotion." Now they're trapped and coping with the disruptions from the nightly riots and I resist the temptation to say "don't say nobody warned you."