# Why can't you generate electricity by transferring objects between fluids of varying densities?

Let's say you have an object travelling between two immiscible liquids like water and oil in an arrangement shown below. (water being blue and oil being yellow)

The object is a cubic meter weighing 999 Kg. It displaces one cubic meter of oil as it passes through it but it's weight overcomes the amount of oil it displaces or its buoyancy. When the object sinks to the bottom of the oil It's transferred into the water. In the water it displaces one cubic meter of water or 1 ton of water so it's buoyancy overcomes it weight and it should float up.

It's then easy for someone unversed in physics like me to conclude that some kind of perpetual motion machine would be possible. I can see the transfer of the object from one liquid to the other would probably cost some energy but it could be easily accounted for by making the pits very deep and generating energy from the moving object.

Now of course I know this isn't possible but I just don't understand why?