No, there is no law that allows you out of your lease if you buy a home. The lease is a contract; as long as the landlord is honoring his/her obligations (e.g. providing you the space you agreed to rent), you are bound to your obligations for the entire term or length of the lease. The fact you want to buy a home does not invalidate or void your obligations, or force the landlord to give up the rent you had contractually agreed to pay him or her.