I took apart a full tube of stripey toothpaste today. To my surprise, I found that there was no mechanism whatsoever of the sort described in the previous answers. The coloured stripes go all the way through the whole tube, ready packed, like in a stick of rock. But presumably there are other manufacturers who use the other method as well. I spread out all of the toothpaste from the tube onto a big sheet of newspaper, and now I am waiting for it to dry, so that I can hang it up and call it art.