I believe it was the new Republic of Texas that got all that land. Right?
Texas fought Mexico for independence in 1836
We (USA) fought Mexico in 1846-1848 after we annexed Texas. We gained much more land after that. Then We BOUGHT land from Mexico Gadsden purchase. To straighten out border lines etc.