Why doesn't this perpetual motion machine using the buoyant force work?

The balls are entering the water well below the surface. The pressure there is much higher than at the surface. The work needed to push the balls into the water at this depth cancels the work gained when they float back up.

We can ignore the gravitational force on the balls since gravity pulls down as much as up as you traverse the loop.

Mathematically, if the balls enter the water at depth $d$, the pressure is $g \rho d$ with $g$ gravitational acceleration and $\rho$ the density of water.

The work done to submerge the balls is then the pressure times their volume, or $W_{ball} = g \rho V d$.

The force upwards on the ball is the weight of the water they displace which is $g \rho V$, and the work the water does on the balls is this force times the distance up that they travel, or $W_{water} = g \rho V d$.

The work the ball does on the water is the same as the work the water does on the ball. No free energy.

The energy needed to submerge a ball is equal to the energy gain from other ball to emerge from the water on the other side, so any waste on friction drives the process impossible.