What got me thinking about this is wondering about XP actions in Chuubo's, which are basically player-initiated scenes that get you XP to level up and where what types of scenes are available depends on the game's "genre". I realized that they serve a similar purpose to purity in my Japan-based LARP Black Ships: not to serve as a challenge or a tool, per se, but to re-enforce desired flavor or characteristics of the universe. Black Ships had an somewhat-elaborate purity mechanic, where various actions could make you impure. It's not that maintaining purity was very hard or necessary for balance; it's more that we knew that players would pay more attention to it and it would effect gameplay more if it were a "mandatory" mechanic rather than just a flavor thing with no teeth. Similarly, Chuubo's could have just said "In a Fairy Tale game, many scenes should focus on suffering adversity, suffering corruption/trauma/metamorphosis, and Never Say Die.", but it'd be a lot easier to fall by the wayside. When it's what you need to level up, it seems like it'd do a good job of motivating players to take a more active role in storytelling in a genre-consistent way. ("What if the weremongoose bites me so I could suffer metamorphosis?") In some ways, it's a similar goal to Fate aspects, but more at a scene level than at an action level and more generally applicable.
Basically, mechanics and roleplaying don't have to be at odds. Some mechanics certainly can disrupt immersion and interfere with roleplaying, but well-chosen mechanics can help with both. While the above mechanics focus on immersion on a roleplaying or narrative level, having mechanics that make player actions close to character actions can also help immersion. The classic is toy guns or boffers for LARP combat, but this can also be stuff like having actual locks for locked doors, or having actual electronic circuits for messing with in-universe devices (as was done in Krazny Oktyabr, also don't get the bomb squad called on you).
Another common purpose for a mechanic is to create a contest that's balanced in some way. You've got two competing teams of PCs in a LARP and you want them to be on an even playing field, or you've got a monster fight in D&D that you want to fit within certain bounds of risk/cost and reward. Hopefully this is something that is fun, interesting, and involves a well-thought-about level of player skill.
More generally, fun can be a goal. Party mechanics that have been used in some longer LARPs are in large part this, though they also have elements of a balanced competition. While hopefully most of your mechanics contain fun, I'm also thinking of things like Quidditch in HP7 as fun-primary mechanics. These sorts of mechanics can be complicated by different players finding different things fun, particularly for standard puzzles like sudoku or cryptic crosswords and more generally for mechanics that are skill-testing in a niche skill.
Relatedly, driving character interaction can be a goal. In LARPs, this can be "require players to leak information about their plots to the rest of game", which is probably what many games are going for with a lot of research notebook steps and is also often a factor in rituals. But some tabletops have this in the form of mechanical motivation for players playing off each other instead of each acting independently. A related goal, for large LARPs, can be splitting players up throughout gamespace.
Finally, a type of mechanic that comes up in longer LARPs is the time delay. We don't want people to finish developing the Ultima cannon until day 7 of game, so we need to put some mechanical restriction in place. These are, in essence, a necessary evil derived from the realities of long, competitive games with lots of players and world-changing plots. I have some thoughts on these, but I won't go off in that direction here. The main point related to mechanical purpose is to use intention when making something a time delay, and not confuse a mechanic that's really doing something else for a time delay. (No one could solve all these cryptics before day three!)
Regardless of your game, I think it's best to have a clear goal for what your mechanic's adding to your game and to think carefully about whether or not it's actually doing that. (And honestly, I wish tabletop books delved into such things more, because otherwise rules can seem pretty arbitrary and ill-motivated.) So, until next time, act with intention.