I think that it has to do with lemmmy and instances. When no one has searched for a specific community from your home instance this community isn't known by your instance. To find a niche community that wasn't known by your instance you must use the exact name of this community (like !asklemmy@lemmy.ml for exemple) to find thoses exact names and brosse all communities you can use lemmyverse.net
As for mastodon you have to search communities with their name but replace ! by @ as if it was a username (!asklemmy@lemmy.ml becomes @asklemmy@lemmy.ml).
The issue with mastodon communities is that they don't use the same type of fediverse tools. You could maybe follow people from mastodon, but the apps or Lemmy/kbin will need to implement a compatibility with those fediverse websites.
To follow communities outside your instance it's a bit less optimised currently as the instances don't scrape all the communities from other servers.
So to find them, either someone else had to search it and subscribe to the community for the server to show it when you search for them, or you'll have to show the server where the community is :