I do the exact opposite. Buying a gift for an expert when you are not an expert is always going to lead to disappointment, no matter how well they hide it. I buy gifts only from areas that I am an expert in, and I hope my friends may not be as enthusiastic about the area as I am, but at least we both know I got them the best for them.
But if you're an enthusiast/expert and they're interested but not to that level, and you have a decent idea of what gear they have and don't have, then it can work.
In terms of coffee beans, yeah, they can be a nice gift if you have a bit of an idea (good small roaster, roast type, e.g. espresso or filter, freshness, etc.) but for me at least, I basically always have just enough coffee for what I need (I buy a new 250g bag of espresso roast about weekly, one or two days before I run out of the old stuff)... But I'm always happy to try something, just don't go overboard and buy a kilo or something! 250g is plenty!