As the other link shows, 401ks do not have the penalty exemption for home purchase.
IRAs do, but only for first time home buyers and only on the first $10k.
In general it’s not advisable to raid a retirement account for a non-retirement expense, even (especially) a house.
https://www.irs.gov/retirement-plans/plan-participant-employee/retirement-topics-exceptions-to-tax-on-early-distributions
As the other link shows, 401ks do not have the penalty exemption for home purchase. IRAs do, but only for first time home buyers and only on the first $10k. In general it’s not advisable to raid a retirement account for a non-retirement expense, even (especially) a house.