Yes, Machiavelli was right, because it is true that a person who is powerful can do what they want. A person who is powerful enough to be elected to a judge's position decides what is right for the rest of us. A person who is politically powerful can often get away with breaking the law without a consequence.
Machiavelli was right when he wrote about how to preserve liberty within a republic by mediating the struggle between the wealthy and the poor and middle class. He also deeply distrusted nobility, which in the modern world would translate either to the rich, politicians or both, because they stood above the law which is still the case for the most part.