You’re basically describing staff travel (ID90). On your own airline or whatever airline your airline has agreements with. You buy a fully flexible fully refundable lowest of the low priority tickets. If there’s a spare seat you get on. If there isn’t you don’t. You know the rules. But at the same time if you don’t turn up you get your money back.
I’ve never ever heard of it available for non staff though. (nominees of airline employee excepted again dependant on airline and agreement rules). It is an extremely valuable (usually) non contractual benefit.
So yes it must be “legal” (as usually non airline employees can benefit from it). But I can’t see any airline going for it.