Some sale documents look like an outright transfer on the surface but actually function as security for a debt, and the law has to look past the label the parties used to see what the transaction really does. Here, A is not simply giving up his house for a price with no strings attached; he is retaining a right to get it back if he repays within a set period, and that right is written into the very same document as the sale.
Section 58(c) of the Transfer of Property Act, 1882 exists exactly for this pattern. It defines a mortgage by conditional sale as one where the seller ostensibly sells the property, but the document itself provides that on default of payment the sale becomes absolute, or that on payment the buyer will reconvey the property. Crucially, the proviso to Section 58(c) requires the condition to be contained in the same document as the sale for this treatment to apply, and that is exactly what has happened between A and B.
Because this is legally a mortgage rather than a sale, B does not get to simply declare himself the absolute owner the moment three years pass without repayment. The Act requires B, as the mortgagee, to approach the court and obtain a decree for foreclosure before the mortgagor's right to redeem is extinguished and ownership becomes truly absolute. Nothing about the transaction is uncertain, since the price, timeline, and consequence of default are all clearly stated, and nothing about it resembles a lease, since there is no rent or tenancy involved anywhere in the arrangement.
So the correct characterisation is a mortgage by conditional sale, and B must obtain foreclosure through the court before claiming absolute ownership.