Moral of the story - (at least some) governments do share this info. Whether it's a pull or push, I can't say.
It depends on bilateral agreements. They are made and broken all the time. One of those things that keeps diplomats and foreign missions busy.
I'd be interested in more detail on how your friend almost got denied entry.