Actually, there has to be a tiny, tiny space between the two. If not for that space, it would not be possible to put the bolt into the nut.
Also, about the tides, one of the reasons for the movement of the ground is the direct pull of the Moon’s gravity. The other is due to the shifting of the weight of the water mass on the land bearing it, due to the tides.
My bad... Whatever the nut and bolt are holding together should have no gap. If they are installed properly.