but if he said offensive things to the person's face, what would the punishment be?
I don't think that's an equal comparison, that'd be more equivalent to sending a user a message.
I didn't RTFA, but it appears that the memorial page had an open comment section and they expected it to not get trolled. It doesn't matter who is in the right here, but that's an unreasonable expectation.
And people on the internet need to learn a bit more about real life. The internet does not actually define the rules of law.
Car analogy: pedestrians have the right of way. That doesn't mean you should try to walk across a 6 lane road with heavy traffic.
In the UK any road of that size is likely to be a motorway where pedestrians do not have the right of way
At the end of the day, your behaviour online still falls under the laws of the Real World. You can be held accountable for copyright infringement, libel and malicious communications amongst many things.
In this case the length of the sentence is likely to have been weighed up with the seriousness of the intent involved, along with how public it all was. Don't forget he'll likely serve less than 12 weeks of the sentence (assuming good behaviour).
Lo! Men have become the tool of their tools. -- Henry David Thoreau