The spell description gives the DM liberty to rule however they want, even up to ruling that the spell simply fails.
When making a wish for something outside the scope of the given examples, the spell description (PHB, pg. 288) gives the DM total freedom to rule however they like:
The GM has great latitude in ruling what occurs in such an instance; the greater the wish, the greater the likelihood that something goes wrong. This spell might simply fail, the effect you desire might only be partly achieved, or you might suffer some unforeseen consequence as a result of how you worded the wish.
So even if you studied contract law and worded your wish in such a way to be technically free from any linguistic loop holes, the spell description gives the DM explicit liberty to simply say: "Your wish fails."
Access to wish should trigger a series of conversations between the players and the DM.
D&D 5e is decisively not a "players vs. DM" game.1 Working together to create a fun and enjoyable social space is the player-DM relationship described in the game rules, as presented in the introduction to the Dungeon Master's Guide (pg. 4-5):
The D&D rules help you and the other players have a good time, but the rules aren’t in charge. You’re the DM, and you are in charge of the game. That said, your goal isn’t to slaughter the adventurers but to create a campaign world that revolves around their actions and decisions, and to keep your players coming back for more! If you’re lucky, the events of your campaign will echo in the memories of your players long after the final game session is concluded.
The success of a D&D game hinges on your ability to entertain the other players at the game table. Whereas their role is to create characters (the protagonists of the campaign), breathe life into them, and help steer the campaign through their characters’ actions, your role is to keep the players (and yourself) interested and immersed in the world you’ve created, and to let their characters do awesome things.
Knowing what your players enjoy most about the D&D game helps you create and run adventures that they will enjoy and remember. Once you know which of the following activities each player in your group enjoys the most, you can tailor adventures that satisfy your players’ preferences as much as possible, thus keeping them engaged.
What we often see with wish is DMs twisting the wording of the wish into undesirable outcomes, and being aware of this possibility, we see this endless cycle of linguistic one-upmanship where players try to word their wishes as precisely as possible, and DMs try to find the loophole.
Let's break the cycle.
I have had great success with wish, both as a player and a DM, and this success depends on one thing: communication out of game between the player and the DM. As a player, when you get access to the wish spell, it is time to have a conversation about how the table wants to handle the spell. As a DM, this is the first of many conversations I will have about the spell. When a player gets access to a wish, I like to talk about what my personal limitations are as a DM and my philosophy for its use. Much like Genie from Aladdin, I like to establish three things:
- Wishes should be worded as non-meta as possible, though I will be flexible about this, so let's talk about it.
- Wishes that make changes to the game rules are probably just not going to happen, but let's talk about it.
- If you are cool with me twisting wishes, I'll twist them while trying to keep things fun, if you aren't cool with twisting wishes, I'll tell you beforehand if it will work as intended.
We're going to talk a lot about wish once it is available, and if you aren't into wishes being twisted, we're going to talk about it some more every time you cast it. At my tables, I have had great success with telling my players what the outcome of the wish will be before we set it in stone. Let's be real, everyone wants to use wish to make something cool happen. And as a DM, I am 100% on board with making this happen. So when a player wants to cast wish, we workshop together what it's going to look like.
I use wish as an opportunity to let my players participate in world building.
After all, this is the entire premise of the spell:
you can alter the very foundations of reality in accord with your desires.
Rather than viewing wish as a player vs. DM pedantry contest, view wish as a tool for letting your players shape the world with the power of their voices. And as always, communication is key. Talk about these things, workshop these ideas together.
1 It should be mentioned that a "players vs DM" style of play is not "bad wrong fun", rather it is a style of play that should be agreed upon prior to starting play. The cooperative style of play is the default style for Dungeons & Dragons, as outlined in the DMG quotes, but when everyone agrees upon a "players vs DM" style of play, it can work just fine. It is when the players expect a cooperative style and the DM is competing against them that we run into conflict.