Neither system necessitates the active oppression and exclusion of out groups.
The problem in both systems is that "merit" is defined by the few at the top, and is often either defined or executed in a way that favours individuals in a preferred class.
What often actually happens is they're judged on executing a standarised test (bureaucracy) or by peers. (oligarchy)
Worse, some systems called meritocracy do not try to properly fit people into functions at all, forcing them instead. In those, you get thrust into a function despite not fitting it and then judged low merit, preventing changing the function. This is a typical bureaucratic failure.
If you measure everyone in a company by how much money they directly make, then salespeople are the best, and everyone else is just drifting along on their wake. You could measure by functionality added, defects found, bugs fixed, projects completed, requirements gathered, and in each case, you assign merit to one class and not to others. Even if you have a reliable way to measure merit in one job family, how do you align the merit metrics across them?
The solution is either to be a judge or appoint a jury, preferably as unbiased as possible. Get a devil's advocate too. You can rotate these people and pick some who do not know much about the person mentioned to be impartial and prevent oligarchies from forming.
Look at number of mistakes and their severity, flaws. Check when and if there are successes and the person working above and beyond the standard of service or overcoming adversity. Look for initiative and improvements.
It works almost exactly like military promotion if you think about it. It's a very human definition and not one turned into a metric. It's what we use and should use in courts of law too. There may be some guidelines to help judging but they should not be hard law as that way lies bureaucracy and lack of adaptability.
Ultimately, all metrics depend on someone's judgement so why not make it explicit and transparent.
The trickiest part is to maintain fairness. Fairness as defined by the subject accepting the judgement, which is different from equality. This generally comes with informing them of why a certain judgement has been made which is contrary to what happens in most companies - both in hiring and advancement.
Unlike meritocracy though, there is no way out of the situation beyond tearing down the system.