You have to tweak your ballistae before you attack. Just make sure you fit 4 titanium robotic legs on them so they could safely climb over the level 1 wall.

Once inside that wall the loot is all yours!

P.S the ballistae can leave the city by opening the gate. They no longer need to climb over that wall to return home.