Outsize U.S. bets delivered foreign investors years of windfall profits, but have left them exposed to this year’s reversal.