He didn't lose, he just cannot serve another term. She belongs to his party and he effectively campaigned for her. His popularity greatly helped boost her in the election. As a result of this election AMLO's party now has such a historic majority in government that the liberal media is fearmongering about how this may even give them a mandate to change the constitution.