It would have been clearer if the sentences were expanded like this:
First sentence: "I love you as much as [I love] him.
Second sentence: "I love you as much as he [loves you]."
Your first sentence means you love the other person as much as you love the boy, i.e, "him".
Second sentence means that you love the other person as much as the boy loves that person.