Hello!
The Treaty of Guadalupe Hidalgo officially ended the war but it also stated that Mexico would cede some of it's lands for $15 million. That made the US grow and it allowed settlers to live in this new lands.
You can feel free to let me know if you have any questions regarding this!
Thanks!
- TetraFish