I am not an expert and you have not provided much information but I think you can. You obviously need to be legally residing in the US. The tricky part is also securing financing. Foreigners on work visas in general cannot get mortgages. Any money you bring in is subject to investigation by the Department of State. So it depends on your particular situation.