So, first off, I’m definitely not arguing this would be a feasible way to get energy in a practical sense in the real world.
But, it wouldn’t be a perpetual motion machine. It’d produce less and less energy as the Earth ran out of angular momentum, ultimately approaching zero.
I don’t think I’ll do the monster math on this, but my gut tells me one could technically and theoretically (not so much in practice) get more energy out of that than it took to get the weight up there. (It might be that the Moon would limit how much energy could be got out of this scheme as well, but I think even with the Moon involved, I think it could still be a net energy gain.) That said, without running the numbers, you might well be right!