Binary_Digit said:
That's because Texas WAS Mexico at the time. The territory was never part of the Louisiana Purchase, but Americans started moving there anyway. The Mexican American war started over disagreement that the American settlers should (or shouldn't) pay Mexican taxes for living on Mexican land.
If that is what your U.S. History teacher taught you, he should be fired.
You are right on one point, and one point only. That Texas was not a part of the LA Purchase, though it did create a border dispute that wasn't resolved until the Adams-Onis Treaty of 1819. Through the 1820s, Americans were moving into Texas at the invitation of the Mexican government. Texas was thinly populated, and the Mexican government wanted more people to develop the province. The Mexican government made conversion to Catholicism a requirement, but it wasn't initially enforced. The beginning of the enforcement of that rule in the early in 1830s along with the official prohibition of slavery beginning in 1829 caused feelings among the American settlers to fester until they, along with some Mexicans also living there who hated Santa Anna, rebelled against the Mexican government and gained their independence with the signing of the Treaties of Velasco in 1836.
The Texans immediately tried to become annexed to the United States, but caught up in the North-South rivalry at the time, the U.S. refused. Texas appealed for Statehood again in 1844, but again that was rejected. It wasn't until President Houston threatened to develop closer relations with Britain that the United States Senate agreed to an annexation treaty with Texas.
The Mexicans, still chaffing from losing Texas were not amused. They immediately broke off diplomatic relations with the United States and asserted that the border was not the Rio Grande, as stipulated in the Treaties of Velasco, but the Nueches River, further to the north. President Polk, after signing an agreement with Britain over the the Oregon Country (angering Northerners - Polk was from Tennessee), Polk went to war, not only to enforce the legitimate claim over the territory south to the Rio Grande, but also to get an excuse to take northern Mexico after the Slidell Mission (which was authorized to purchase the territory) was rebuffed by the Mexican government.
Your claim that Texas was a Mexican territory when the Mexican-American War began is totally incorrect as Texas had already gained its independence a full decade before the Mexican-American War began.