It's a little more complicated than that. A pile of salt doesn't have nearly the cohesion that the ground does, and mercury only resembles a ball when you take surface tension into account. Both very scale-sensitive questions. But mostly yes, it looks like surface tension is the answer.