If you sat Ferneze and Barabas down in the principle's office, they'd probably swear up and down that (1) their actions are justified and (2) they have absolutely nothing in common. Being clever, you'd know they're both wrong.
Both of these guys can be read as Machiavellian characters. They're each willing to do immoral things to reach their ends, whether that means twisting religious principles, outright lying or breaking treaties and promises. But why? What are their goals?
When Ferneze justifies confiscating the Jews' property, he says
…we take particularly thine
to save the ruin of a multitude;
and better one want for a common good
than many perish for a private man. (1.2.96-99)
In other words, he's working for the common good. (Or so he says.) He "preaches the Jews out of their possessions" because he thinks that saving Malta from the probably-not-fun attentions of the Turkish army is more important than being fair to the Jews. He bargains with and betrays Barabas in the fifth act is done to restore order and safety in Malta.
Not Barabas. Barabas is a lot more like the Joker: insanely complicated set-ups and a self-proclaimed desire to mess everybody up. Where Ferneze's goals are clear throughout, Barabas's motives erode over time into a sort of gleeful, destructive anarchism.