Nowdays regardless of what I'm doing, I won't say anything that'd remotely indicate that I might ever want to live in any country I'm visiting, lest I get in more questioning and hassle. And I'm an American, mind you, not exactly the country that people get the most skeptical screening process from.
If I was from a Baltic country or developing country, I'd try to casually work into conversation that I had serious commitments back home - good job, mortgage, graduate studies, serious relationship, things like that. (Actually, now that I think about it, that's what finally got me through that London questioning - when I mentioned I had to be back in Boston for my studies starting in late August, it was around July at the time IIRC, roughly five years ago)
On the Visa Waiver there is (used?) to be a box to tick if you had been denied a visa. I would imagine being denied a visa and not winning a Greencard are two quite different things.
It's some sort of twisted logic where ICE thinks that you'll try to jump the line if you travel to the US on a non-immigrant visa.
I think your friend might be having some other issues, not the DV lottery.