Earlier quoted context omitted.
There are loans and there are "loans". This isn't El Salvador issuing bonds on the market, it is politics that comes with political conditions. That means they negotiated it and that means they got something in exchange for any leverage they could find.
The IMF are tough guys, countries do not want to owe them, but usually don't have better options. They don't give "loans" and impose rather strict policies on everything. https://actionaid.org/publications/2023/fifty-years-failure-...
1) A country is doing something the US doesn't like.
2) The country is in some trouble of their own making.
3) The IMF will come and bail them out if they would be inclined to start doing the things the US likes instead of the things it doesn't like.
The uncharitable interpretation of "2)" is "the country is doing alright so the US overtly or covertly causes problems for them so they become in trouble".Basically, the IMF money is the carrot you get for bending the knee. The stick can be the CIA or other things.