Keith: There are literally thousands of different strains of Zea mays, all of which were selected for their various traits by the ancient Mesoamericans and South Americans; the brighter colours are not only food, but also have religious significance in many communities (to this day). They're all descended from the same species of grass, so the polymorphism is extremely low (compared to something like tomatoes, which are from five or six different species) and the cultivars cross-pollinate freely.
Corn is wind-pollinated and to a lesser extent bee-pollinated, so it can and does cross borders, but each kernel in a cob is the result of one grain of pollen, so a single cob, like the ones pictured above, can contain genetic material for 2 or 5 or 6 of 10 cultivars.... Case in point: I grow yellow sweetcorn in my yard; I am fairly far away from anybody else growing corn so the wind will only self-pollinate my plants. However, my corn is also visited by carpenter bees, which are large wanderers. Last harvest, I had a couple of ears with random blue kernels in them; the closest blue corn to me is about 30 blocks away, and I'd guess that this is the effective range of my bees. So, by planting straight-up yellow, red, and blue corns, you would end up with multicoloured heads, but multicoloured corn produced that way is a trait that doesn't pass generationally - it's a result of random cross-pollination between the three colours.
What does limit cross-pollination in corn, apart from wind and bee radius, is the time at which the plants are in flower. In order to get the multicoloured heads, all three plus of the varieties you grow have to come into bloom at roughly the same time in order for the pollen to be viable in producing the kernels. This is why corn is almost always planted in hills of two or three plants of the same variety: enough coming into bloom at the same time guarantees full pollination and therefore full cobs.
The very fancy corns of six and seven colours that come from a single seed, like those shown in the last picture, are traditional cultivars, which are the result of generations of selective breeding; it's possible to get seed for some of them in the Americas but they're becoming more and more rare as the large-scale farms of gold sweetcorn dominate what's grown, especially in NorAm. Here in Ecuador at least there are seed banks to preserve our traditional corns (which are pretty cool - we have blues with pointed rather than rounded kernels and a whole range of reds to rusts that are nutty in flavour, as well as the giant-kerneled mote corns....)