Yes, a "lease with option to buy" is a legal way to purchase real property. A lease option allows the buyer-tenant to work towards the purchase of the house without an obligation to buy. You become the owner with full title if you excercise the option to buy.
These are not too common for residential property, more common for commercial property, Basically, you are promising to buy a particular piece of property within a certain time-frame, generally at a price determined beforehand. The process for determining the future price is agreed to between the buyer and seller and will be implemented at some future date. For example, the future price might be determined by an independent, licensed real estate appraiser, paid for by either party or jointly, before the expiration of the lease period.
Such arrangement usually works well if you do not have sufficient down payment for a traditional purchase and/or if you have poor credit since restrictions on qualifying for a lease option are not as strict as in conventional home financing.