Spain lost control of California in 1822.
Yes dear, I KNOW, but the CLAIM to the land that Mexico inherited came from Spain and the two treaties concluded with the Pope and the King of Portugal: The Treaty of Tordesillas (1495) and the Treaty of Zaragosa (1529).
The land grants given after 1821 (the first Mexican revolution) by the Gobernadors (Pio Pico for example) were based on the authority originally granted under those treaties, passing into the hands of the newly independent Mexican nation.