I think they probably had the mistaken idea that they could pay back the loan and get their gold back. Of course that’s not going to happen. It would have been more honest if they just sold it, like you said.
Also it was more politically palatable. They could tell the citizens: “We’re not selling the gold we’re just using it as collateral for a loan.
IMO
Cheers