> Why was he arrested for planning to have sex with her? Is that now illegal?
In the US, as in most countries, it is not true that it's only a crime if you succeed. So yes, planning to have sex with a 13 year old girl is a real crime.
A "thoughtcrime" (one word, from the book 1984) is an unacceptable belief. No action is required for these bad thoughts to be a crime, just the idea is a crime. He didn't merely have the thoughts, he took actions. Contacting a minor and going to meet her far exceed mere thoughts.
You're free to fantasize about killing your boss, but if you buy a gun and hide in the bushes outside his house and fire the gun at him (but miss), you've still committed a real crime. If attempted murder can be a crime, I don't see why attempted statutory rape wouldn't a crime. In fact, I don't see why soliciting a minor (even if he/she says no) shouldn't be a crime (it is).
Thoughts, ideas and motivations have always been a part of the law. The distinction between first degree (premeditated) murder and second degree murder predates the United States by thousands of years. In order to distinguish accidental and intentional murder, a jury must speculate on the thoughts of the accused. These personal thoughts are revealed through actions. We don't call that "thoughtcrime".
Contacting a minor, making plans to have sex, and going to meet her are all actions that the man took and are obviously illegal.
None of this should be seen as a defense of Facebook for spying on private communications. I just want to clarify that attempting to commit a crime is still a crime.