Why doesn't this magnetic perpetual motion machine work?
If the magnet is powerful enough to pull the ball up from the bottom of the ramp, the force on it will be quite strong at the top of the ramp.
If so, why would the ball drop through the hole? The pull from the magnet will overwhelm gravity.
Even if you constructed one where the ball could fall through the upper hole, I don't see any reason why it should go through the lower hole. If the magnet can pull it up the ramp, the pull from the magnet should prevent it from reaching the hole on the lower ramp.
There is no problem assuming that the ball will fall trough the hole. Even is the magnetic force is large, it only needs to be larger than the gravity component along the inclined surface. This component is $mg \cos \theta$. Once the ball gets to the hole the gravity felt by the ball increases to mg, so it can happens that the ball that initially went up now goes goes down the hole.
However, notice that as the ball moves downward the gravity force starts to diminish again (is becoming more horizontal also the magnetic force decreases as the ball moves away from the magnet. If you make a graph about both forces you will find that there is always a point on the ball's path when both forces have the same magnitude but opposite sign. That will be the equilibrium position of the ball, where it will stay at rest if you extract all its initial kinetic energy. Thus it is not a perpertum mobile after all.
If I were designing the experiment
I would make the inside surfaces of the ramp out of of mu metal to shield the ball once it falls in the hole, otherwise a strong magnet will be pulling it back up the lower incline.
I would use an iron ball with a smooth glass coating to reduce friction
I would use a glass upper ramp , again to reduce friction
A judicious use of mu metal could shadow the magnetic field as the ball reaches the upper hole so as to be sure to drop.
It might work for some time if correctly designed. Suppose it does, certainly no energy can be extracted from the system . Even if the friction were zero there would be loss of the magnetization of the original magnet over time: to pull the ball energy must be supplied to the iron ball's magnetic domains and this over time will demagnetize the red ball. Of course all the other considerations of friction and impact energy loss as it falls (maybe etc, just these two come to mind) will lead the ball to finally stop in the lower ramp.
Here is a different kind of perpetual motion, where thermodynamics is more evident.