Is it legal to have a third party buy a home for you?

Typically the person that signs the paperwork to buy the house owns the house. They can, of course, sign the house over to you after buying the house.