There are two main reasons for this: Either they only see you as someone who is only good for getting what they want if you have it or they aren't close enough to you and they'd feel awkward if they came up to you without actually having something to talk about. Either way, it doesn't mean that they hate you or anything like that. It simply means that you aren't valuable to them or close friends. Of course you can fix that if you want to by getting to know them more, but it's also all right if things stayed that way. Not everyone can be good friends you and you can't please everyone. Yeah it gets kind of annoying, but they usually don't mean any harm. And when you think about it, I'm sure there are people you do this with too.
So first reason is that they don't see you as anything else, but a resource. This could be because they are using you adn trust that you'll give them the most reasonable answer, or it could be because they know that you're easy to get information out of. Either way, I wouldn't count that too personally because people like that aren't your real friends anyway. If you want this to stop, then try getting closer to them or just ignore them all together, acknowleding them only when necessary. Although if he or she sees you only as a person to easily getting information out of, he or she can be quite tricky to deal with. You have to watch carefully of their actions because you might be dealing with someone who is secretive and manipulative (I know someone just like that; she's really annoying and has caused me to dislike her a bit). As horrible as that sounds, they're not as common as you think. They're most likely just trying to use you and you should probably stay your distance from them or do the same thing with them (only approach them when you need them).
The other reason why this person may be doing that is because he or she doens't know you that well. When you are with your close friends, you can usually just randomly come up to them and talk about anything, right? But with your not-so-close friends, that would just be awkward. You guys don't know each other so well, you guys have never really had much meaningful or funny conversations, and you simply don't have anything to actually talk about with each other. Either that or they might want to impress you somehow and don't want to appear weird or stupid. So maybe this person is just trying to talk to you but doens't know what to say, thus they only talk to you when they need you as an excuse because it won't seem as awkward that way. You catch what I'm saying? I'm pretty sure that you've done this too. I mean I end up doing this all the time when I'm trying to talk to my crush or someone who I want to befriend. I don't want to look like a fool to them but I don't know what to say, so I just ask them for things. It's a pretty bad habit, but it does happen and it's natural.
So stay positive about this and keep an eye one them and their behavior. Their body language can tell you more than you think.