The correct answer is mexico refused to trade land for peace.
Eventually they had to trade the land since the war ended in what is considered by many a stalemate. Of course, the United States got a lot of territories so it was a good stalemate for them and nowadays it is considered to be a victory. Texas also became sovereign and independent.