Keep in mind that it isn't necessary a binary thing between connected and not. Some airports (e.g. ORD) have some terminals connected airside where some are not, also some airports it may be possible to go between terminals airside, but not worth the hassle.
Some airports (including JFK) do allow travelers to go through security at a terminal other than the one they are flying out of. Again, may not be worth the hassle to go to a lounge, but it may be possible.