Rykion
Explorer
To follow the RAW, DMs have to "metagame." They're supposed to have the party run into appropriate CR encounters, and give out treasure within the guidelines. Even with the CR system, a DM sometimes has to adjust encounters to make them appropriate for the party's PCs. Using the rules to create NPCs specifically to challenge the PCs is a big part of the game. It's not really metagaming as it's the DM's job to consider how the rules, setting, and players interact in a way to create an enjoyable game.