You are thinking of Ricardo's Comparative Advantage; and it is a little more complex than that they got machines: they traded for cloth, which was made with machines that the British then spent the time to improve and learn from, giving them eventual advantages in numerous other fields.
http://m.huffpost.com/us/entry/free-trade-us-unemployment_b_...