How do I get a ball to be affected by gravity but not “bounce” off the walls?
… I don’t really know what you mean - bouncing off of the walls is normal. If you want the ball to just have a maximum movement on an axis so that it wouldn’t go past the wall, you should use Python to make sure that the walls don’t exceed the bounds of the wall (you could just use a variable to store the maximum bounds of the wall on a certain axis).
I think this are the restitution settings of both materials, of the ball and of the wall.
BTW: If you use loc to move the ball, you have no chance