The sugar is all dissolved in water, since it is created from starch that is either dissolved or gelatinized. Solid sugar never exists in the mash.
The grain bed is like a sponge. If you have a sponge in a bowl of water, and pour off the water, there is still a significant amount of water in the sponge. If you squeeze the sponge, you get some of the residual water out.
Now let's put the sponge in a bowl of sugar water. After draining off the liquid, the sponge still contains some sugar water, and thus some sugar. If you add more water to the bowl, and squeeze the sponge a lot, you can equalize the concentration of sugar between what was in the sponge and the added water. Now when you pour the water out of the bowl, the sponge contains about the same amount of liquid that it did the first time you drained the bowl, but a lot less sugar.
Now let's do the same thought experiment, but without the sponge, and this time we'll throw in some numbers to make it quantitative. Let's say we have a container with 10 gal of liquid that is 10% sugar. If we pour off 9 gal, we still have 1 gal of liquid in the container that is 10% sugar.
If instead of starting with 10 gal of 10% solution, we start with 5 gal of 20% solution, and pour off 4 gal, we have 1 gal of 20% solution left in the container. If we add 5 gal of water to the container and mix well, we have 6 gal of 3.33% sugar. Now we pour off 5 gal of the 6 gal, leaving 1 gal of 3.33% sugar solution in the container.
The second process leaves only 1/3 as much sugar in the container, thus more sugar is in the drained solution. We had the same total volume of solution, and the same volume of total draining, but got more of the original sugar in the drainings than the one step process. That's how sparging works.
The above is a little over simplified since it ignores the details about specific gravity, but it demonstrates what is going on with sparging. The simulations I used to make the chart take into account all of the gory details.
Brew on