You're referring to the New Economic Policy [0].
For both, the purpose was not only to get foreign investment, but to improve internal economic efficiency, since collectivization and central planning were lethally inefficient [1][2].
[0] https://en.wikipedia.org/wiki/New_Economic_Policy