The IMF is the lender of last resort. Countries go there when nobody else wants to give them a penny anymore, mostly because they screwed up their public finances through incompetence and graft. The IMF lends at low rates but in exchange you need to fix stuff. Basically, be more competent, steal less, and act with some responsibility. It is all very transparent but politicians do not like it because it means they may get the boot at the next election.
The Chinese loans, those are very different.