By declaring he’d put tariffs on goods from the South American country, the president imperiled a growing influx of foreign investment there.