(d) In the event that the original purchaser of a one-family or two-family dwelling unit sells, assigns, transfers or otherwise conveys any interest in such unit, the entire unpaid principal balance of the note, with interest thereon, shall become due and payable. In the event that the original purchaser of a one-family or two-family dwelling unit ceases to occupy said unit, the entire unpaid principal balance of any loan, made pursuant to this section on and after April 9, 1976, with interest thereon, may become due and payable at the discretion of the commissioner. If such sale, assignment, transfer or conveyance takes place within seven years of the original purchase, the state, acting by and in the discretion of the commissioner, may recapture a portion of the assistance it provided to finance the purchase of the unit, to be determined as follows: The original purchaser shall pay to the state an amount equal to the sum of (1) additional interest representing the difference between the actual interest paid by the original purchaser on the permanent mortgage loan and the interest that the original purchaser would have paid had the terms of the mortgage loan required interest at a rate of eight per cent per annum, from the date of execution of the mortgage loan to the date of prepayment of the mortgage loan; and (2) fifty per cent of the net appreciation if the unit is resold in the first, second or third year, thirty per cent of the net appreciation if the unit is resold in the fourth or fifth year and twenty per cent of the net appreciation if the unit is resold in the sixth or seventh year following the original purchase. Notwithstanding the provisions contained in this subsection, the total amount of such recapture shall not exceed the net gain realized upon the