When borrowing builds nations — and when it burdens them