He deposited something in return for getting some money, but when he wanted to take it back, they asked for more
It is permissible for the borrower to give something that he owns and that has monetary value, as collateral, whether the value of that thing is less than the value of the loan, or the same, or greater, as a guarantee or surety for the debt that the borrower is committed to paying and so that the lender will be able to take his due if the borrower delays paying him back.
Ibn al-Mundhir (may Allah have mercy on him) said:
They [the scholars] are unanimously agreed that giving collateral when at home and when travelling is permissible.
End quote, al-Ijmaa‘, 148
It is not permissible for the lender to ask the borrower for more than what he gave him or to stipulate that as a condition. The scholars are unanimously agreed that every loan that brings a benefit is haraam riba; it is not permissible to enter into such an agreement.
See also the answer to question no. 59867
And Allah knows best.