It's because you are a girl and he is a boy. It doesn't necessarily mean he is interested in you, but it is a girl boy thing. If you were a guy, I doubt he would hug you, especially not after the second time you've talked. Now, if you are concerned about him feeling left out, don't be. Let's list the options:
1. You hug him back. That might send the wrong message.
2. You shake his hand. That might send the wrong message.
3. You shake his hand, then feel bad about it and talk to him out of guilt. That might send the wrong message.
4. You hug him back, then feel like that;s too much, and withdraw a bit. That might send the wrong message.
5. You fart on a candle in his house. That might send a bill to his parents.
So there is always a possibility of sending a message, and in order to control the messages you send, you have to know the other person better than anyone, and even then, how do you control the messages? So just be you, and that should send the best possible message.