This isn’t a terrible idea like I initially thought. Permanently attach a heavy counterweight to the base of the overbed table and it’ll be more stable.
I’m hoping OP will be able to find an overbed table for situations where sliding the base under the bed isn’t possible. They can’t be the first person in the world with this problem.
Without the base being under the table it is just a lever. Sure, people run into this, but you basically need a large and solid frame off to the side to keep it from tipping.
Placed at the very end it would be evenly balanced at 50 lbs. It would be OK around 20ish lbs that didn't move, but a little weight plus setting things down would make it wiggle and possibly tip since something moving down has more force than the object itself.
That table telescopes. Looks like it already has a way to adjust?
In any case, you could also add feet to the bed. I’d drop examples, except without knowing more about how the bed is made, the specifics get a bit wonky
Another option is taking a couple 4x4’s and trimming them down to the right height and setting them out in a frame- bed on top. (2x4’s are not quite 2”, but if those are thick enough, even simpler,)