Yes, here are the rules and exclusions: (I think only $10,000 penalty free on a house) https://www.investopedia.com/articles/retirement/02/111202.asp