EDIT: I don't have time at the moment to improve this answer, and it contains some claims that are plainly wrong (i.e., using Hydrogen atoms as example was a bad idea as they don't behave like this at all; and the main part of the explanation is not that great, I feel). I wrote it in one sitting and didn't take time to think about it more. I pondered deleting the answer, but since it did garner quite a few upvotes, people seem to see some value in it at least. Check the comments on some problems of it, and maybe take a look at the linked video from an actual physicist.
But what if the diameter of the ball is exactly the same as the inside pipe diameter?
You are hitting a very interesting question here that is a general observation about reality: the concept of physical objects "touching", as we use it in every day life, does not make sense on an atomar physical level, or at the very least is quite difficult to reason about, or even to define what it means.
Atoms are made up of a positively charged core, and a negatively charged cloud of electrons surrounding it (for this particular question it does not matter how the electrons function, exactly). The fundamental interaction of relevance here is that of electromagnetism, we can ignore the other three. Electromagnetism repels particles of equal charge.
Interestingly, if you compare the sizes of the particles involved (both the nucleus as well as the electrons), to the radius of the electron cloud surrounding the core, the latter is larger by orders of magnitude:
- Nucleus: 1.70 fm (Hydrogen), 11.7 fm (Uranium)
- Atom: 25 pm (Hydrogen), 170 pm (uranium)
Nevermind the concrete numbers, but observe that the first is femtometers, the second picometers, which is a factor of 1000 already. So the hydrogen atom as a whole is ~14,000 times larger than its core, and, geometrically speaking, nearly all of it is the negatively charged electron cloud.
Also remember that electromagnetism falls off with distance - you know this from everyday magnets; the closer they get, the more significant the forces become, and not in a linear fashion.
To get to the point: imagine two regular, uncharged Hydrogen atoms approaching each other, getting ever closer and closer. Since they are uncharged, when they are relatively far from each other, electromagnetism has no relevant effect, they will approach each other easily. Of course, electromagnetism still is in effect, but with the relatively large distances, the electrons within the one atom will attract the nucleus of the other, and vice versa; but also the electrons in the one atom will repel the electrons from the other. Due to the large distances, these forces cancel out - they will never be mathematically zero, but they will soon be so little that they just have no effect.
Now imagine the atoms getting very very close together. At this point, the electron clouds are, relatively, "closer" to each other than the respective cores. Since the force generated by the electromagnetic interaction is not linear, the effect of the electrons repelling becomes more significant than the electron-nucleus attraction. In the end, the atoms will deflect each other. In an idealistic scenario where they move towards each other "head on", they would slow down and eventually fly apart in the same line (in practice there would always be some sideways component of course, but that's not the point here).
In every day regimes, which we are talking about here, it is utterly impossible that the two atoms do anything we would call "touching" or even "merging"; due to the EM forces they would separate much before they would somehow geometrically reside within the same volume of space in any meaningful manner. This is of course possible, but then we're talking about high-energy experiments at CERN or in fusion reactors, not balls in pipes.
TLDR: individual atoms do not touch or even come close to each other in any significant sense, in everyday regimes.
Now take your macroscopic ball and tube. They are made up of atoms in some kind of 3-dimensional grid structure depending on material. No matter how that exactly works (for example, metals bond differently than other materials), one constant would be that there will always be a (now relatively thin) cloud of electrons on the outside. (Remember, we are always talking about uncharged, everyday materials here.)
The same concept as before applies. If two macroscopic objects "touch", what happens in truth is that their outermost atoms (obv. a great great many of them) get ever closer and closer, until eventually they are close enough that the electromagnetic interaction between the electron clouds of the closest / outermost atoms becomes significant enough to repel. Let's also just now ignore more complex scenarios like very porous, fluid or otherwise different materials (no velcro straps ;) ).
So to get to the final point: it is impossible to have your ball have "exactly the same diameter" as your pipe, as there is no well-defined diameter. There will always be a wishy-washy region where the objects are maybe a little closer than before, or where the forces become too large to continue. If you "press harder", this region might shrink. If the objects start out with significant kinetic energy, the region might shrink. Etc. but physically, the objects will never "touch" at all, unless we get into destructive regimes.
As you can imagine, none of this is up for easy, exact mathematic treatment.
Check out the video "Do Atoms Ever Touch?" from the Sixty Symbols channel for the same explanation in a much more entertaining way.