Can the DM Cheat in D&D? And Should They?
One mainstay in Dungeons and Dragons and most other tabletop roleplaying games is the dungeon or game master as the "absolute power" when it comes to defining and even breaking the rules to the game. This is true in D&D 5th edition rules, which specifically state that the DM -- not the rules -- is in charge of the game. Furthermore, the DM can create new rules, alter the stats for monsters, change how spells work, etc. In fact, the DM can cheat by fudging rolls or simply dictating what happens without even a roll of the dice.
Or, put another way, the DM can't cheat because they are allowed to do whatever they want, thus, if a DM changes a natural 20 to a 17, it is completely within their rights as a DM and thus not "cheating".
The real question is: Should the DM cheat at D&D?
Absolutely.
A good DM will cheat in many ways for many different reasons. In fact, "cheating" or rule-breaking/bending is so commonplace that almost every group does it, including famed groups like Critical Role. Any use of homebrew rules, especially those that outright change how things work in the official rules, is a case of bending/breaking rules.
Cheating does not make a person a bad DM, or for that matter, a good DM. Fudging dice or changing rules on the spot can be the hallmark of a DM that has let the power go to their head or a DM that is trying to create the best time for their players.
Want to play D&D without a DM? Endless RPG can help.
A Few Ways a DM May Cheat for the Good of the Game
What amounts to cheating will differ from person to person, so for this section I will assume that using popular homebrew mechanics are considered perfectly fine. In fact, anything that the players and the DM have agreed upon no matter if it is a change in the rules or an addition to them shouldn't really be considered cheating.
Fudge a Dice Roll. A basic rule of thumb I always used when being the dungeon master was to limit the effect of simply bad luck in dice rolls. In essence, if a player was doing everything right but was constantly rolling poorly on the dice, I might fudge an attack roll against their player and turn a natural 20 into a miss or simply dish out the minimum damage. I wouldn't take this too far. We played with permadeath, so bad rolls were going to lead to death, but I would certainly give the character a fighting chance against that streak of bad luck.
Nerf a Spell or Ability. Many of the spells and abilities in D&D can be overpowered, especially when used by creative players. In fact, challenge ratings and how many encounters a group can face in a day are often dependent as much on how good the players are at tactics as the actual levels involved. In terms of spells, Heat Metal comes to mind. It does a fair amount of damage for a level 2 spell, it can continue doing that damage over time, it doesn't have a way for the target to make a "save" to avoid the damage, and if the target is wearing armor that they discard to get way from taking damage, the spell is effectively a debuff to their armor class as well. And there are far more spells and abilities that can be used in creative ways to create an overpowering effect.
Modifying Encounters On the Fly. The design of many adventures hinge around the difficulty of the encounters. This doesn't mean every encounter is meant to be difficult. In fact, a common DM trick is to produce easy encounters. This might be to scale things up as the adventure progresses, or simply allow the characters to see their own progress. (Hey, remember those bugbears you thought were difficult three modules ago? Now look how easy you take care of them!) But sometimes the best-laid plans are disrupted. For example, a bandit attack on a boat dock that was supposed to overwhelm the party and push them back into the city begins turning into an easy victory thanks to a steady roll of natural 20s. The DM 'cheat' solution? More bandits! Or maybe a sea monster. Of course, the DM might simply alter the story on the fly, but if it is an important plot point, a bit of DM cheating may be required.
Removing Encounters, Traps Etc. This is the opposite of adding more to an encounter. What if you've misjudged how much the group can handle? Or they've had a series of bad rolls that took their toll and now they are going to enter a trap-filled room that has a high chance to being lethal. A good DM might take into account their own mistakes (packing too many monsters into the dungeon) or the role of bad luck (or the bad luck rolls) and tone things down a bit to favor the players.
Sometimes, People Die...
None of this should be taken as advice that characters should be kept alive at all costs. In fact, I'm actually for a bit more 'hardcore' playing where death is very much real. I feel that the prospect of death (or permanent injury) adds to the game by providing a certain amount of tension during combat and a certain amount of achievement when emerging victorious.
This isn't to say that playing with hardcore permadeath is "better" than any other way of playing. There is no better way of playing D&D. There is only fun ways and not-as-fun ways, and if a group is having fun, that's the main barometer.
But you can have a harder stance on death and still help the players avoid it. If players are doing everything right, it is the DMs job to do what they can to help them survive. Sometimes bad rolls are unavoidable and people die no matter how good of decisions they made. As a DM, if I fudge that goblin's roll from a 20 to a 2 so that they'll miss the character with 3 hit points left and the next time I roll for the goblin they get another natural 20, the fates are deciding... It's the type of balancing act that DMs sometimes have to walk.
But Is It Really Cheating?
Again, technically, the DM cannot cheat. They are the master of the rules. If they break them, that is their right. If they change the roll of the dice, that is their right. In fact, this is why many DMs roll their dice behind screens -- so they can do what they want with the numbers.
The better question here may be whether or not a DM playing fast and loose with the rules is doing so for the betterment of the group. A good DM cheats to add to the fun. The DMs job is not to kill the players. Certainly, a bad DM can 'cheat' to the extent of creating a poor atmosphere for the game. But the key here isn't so much the cheating as it is the ability of the DM.
Not everyone is cut out to be a DM in the same way that not everyone is cut out for management at a company. The idea that the DM has the ability to break rules and cheat when it comes to the dice is based around the idea of giving the DM the power to ensure everyone has fun and that the story is told, not to give them power for power's sake. And a good DM uses this as it is intended.