It is a taxable distribution regardless of where it is spent.
If an IRA and first time home buyer you can exclude $10,000 from the early withdrawal penalty if you have one.
https://www.irs.gov/retirement-plans/plan-participant-employee/retirement-topics-tax-on-early-distri...