The lease may provide that the lessee may, at the expiration of the original or any extended term, purchase the leased premises at a stated price, which shall be the balance of the total cost of the erection of the building and appurtenances not amortized by the payments of rents previously made by the lessee. The lease may provide that in the event of the exercise of the option to purchase the leased premises or in the event the lease has been extended for the full number of years which it is agreed the same may be extended, and all rents and payments provided for in the lease have been made, the lessor shall convey the premises to the lessee in fee simple with covenant of general warranty of title.
SDCL 5-12-15