First, justice doesn't exist. It's an abstraction used to legitimize enabling authority to remove people it finds a nuisance from proximity to those authority doesn't find a a nuisance, often for the safety and security of the non-nuisance folk, but sometimes to ensure authority remains authority. The root of the word doesn't refer to fairness, or equity, but wisdom.
The medieval lords varied in arbitrariness. Prior to the Norman Conquest, the Saxon Carls of England were highly legalistic and their traditions and law constrained what could be done, and compelled what must be done in their dealings with their subjects. There were, as you imply, other medieval cultures where law was a reigning aristocrat's whim.
As to the equity of our system, it's pretty slanted. I'd be curious to run the stats on conviction for a non-violent felony common to all socioeconomic sectors, like possession of a controlled substance such as opioids. Penalties can run from small fines to 10 years in the slammer. Once you control for the price of the legal counsel an accused person can afford, I'm willing to bet that you'd find that penalties get stiffer the further down the tax-brackets that you go, and stiffer the darker the defendant.