Foreign investors are repatriating their funds on an unprecedented scale. Ironically, the measures being taken to resolve the crisis in advanced countries are making it more attractive to bring money home, making life harder for emerging-market countries.