Adding on to Senjumommy Senpai's answer:
Another aspect to Flutter Mane's viability is Sun. With Flutter Mane's already destructive capabilities, gaining a free stat boost just by using a weather setter can make it extremely unbearable for the metagame, even if it means using a generally subpar Pokemon like Torkoal. This will, in turn, effectively widen the BST gap between it and Gengar. In contrast, Gengar's ability does nothing to help it, at best leaving a parting gift when it faints from a move like Knock Off. Flutter Mane can also stack damage boosting items inside Sun to bolster its damage even more, or effectively give two stat boosts simultaneously. For example, Mane's go-to item, Specs, gives it a damage boost, while Protosynthesis can boost its Speed inside Sun, allowing it to outspeed literarily the entire unboosted Ubers tier.
Flutter Mane also has 135 Special Defense, a stat many forget about until they try to knock it out with a somewhat strong Special attack, like Lunala's Meteor Beam, only to realize it doesn't even come close to OHKOing it. This forces the opponent to respect the stat. For example, Lunala can't grab the Special Attack boost it wants from Meteor Beam against Mane, forcing it to knock it out with Moongeist Beam and thus losing the Special Attack boost. Compare this with Gengar, who is knocked out from the same attack 93.8% of the time, and you start to see how significant Flutter Mane's Special Defense may be. (Both calcs are done with no bulk investment.) This heightened Special Defense has applications everywhere. In a more OU relevant context, take offensive, Choice Scarf Gholdengo's Shadow Ball. A Flutter Mane with no defensive investment can actually live a hit from full health, allowing it to fulfill some sort of defensive utility against it should the team require it to do so. In contrast, Gengar loses to Scarf Gholdengo every time. Basically speaking, more Special Defense allows Mane to fire off its attacks more often compared to Gengar, allowing it to exert more pressure on a game to game basis.
As to why Gengar is in RU and not a higher tier, its Speed makes it lose out on a lot of big threats above. In OU, good luck outspeeding and dealing with Dragapult (which is the whole reason Gengar fell out of OU in the first place imo), Roaring Moon, and physical Iron Valiant, while having to deal with Sucker Punch everywhere from the likes of Kingambit. Sure, Gengar can run Scarf or Substitute, respectively, to alleviate the aforementioned problems, but that either cuts into flexibility or Gengar's already limited moveslots. In UU, Focus Blast is mandatory for Tyranitar, not to mention the other Dark types in Weavile, Lokix, and Greninja, all of which outspeed Gengar and/or have priority. In sum, the existence of Dragapult of a faster Ghost type, the plethora of Pokemon that can outspeed it, as well as Sucker Punch being everywhere makes Gengar not viable in OU or UU.