I honestly don't know either why they feel the need to paint or stain mulch, or what the material is that they use to color it. My guess is that the color is from some natural mineral pigments, such as several types of iron oxide or rust, and for black, probably carbon or charcoal.
More worrisome is that the vehicle or solvent they use to get it to spread and stick to the mulch. That may just be water, and something like starch or gluten. The reason I think they use these simple harmless things, besides that maybe they are trying to be eco-friendly(not always a safe assumption these days) is that the more dangerous stuff like in real paints, like heavy metal pigments and lead and hydrocarbons and latex and polymers is that those things all cost a lot more money than earth pigments, ie just dirt in some locations, and simple binder/stickers like paste and glue.
The reason they color the mulch is I guess that people want it, but I think it started when there was a this kind of tree in Florida that was non-native, a type of eucalyptus, that they wanted to eradicate and they cut them all and ground them up for mulch. That type of eucalyptus had a very reddish brown colored wood, and fresh mulch was the reddish color.
Those trees are all gone now, and they use other trees, like cypress and cedar and various hardwoods, like peoples yard tree trimmings, which are mostly more white or light colored. The more organic and natural way to color those mulches is to just compost them for a little while, and they get naturally dark, but not necessarily a consistent color.
I think the idea that mulch has to be uniform in color is sort of silly. I recommend using a variety of materials and sources for mulch. Leaves, broken up twigs and stuff you pick up off the grass, plus several types of boughten mulch all are great.
Another more insidious reason they color the mulch might be evident when you see what happens to these mulches after a year or so, when that color starts to weather and wear off. You start seeing the underlying wood color, except that it weathers too, into a grayish silver. The effect is sort of like a painted backyard fence, that hasn't been maintained and the natural aging patina is trying to come through, but the pigment is still present too. Worst looking than either condition, never been colored, or freshly colored.
I suspect that the Depots and Lowes want people to rake up all their aging mulch and completely replace it. I even saw a quick HowTo commercial on Saturday TV by Home Depot that recommended cleaning up all the old mulch and adding all fresh new. VERY BAD ADVICE and I haven't seen the ad since. I don't watch much Saturday TV though. The whole point of mulch is to protect the soil, but also to break down and feed the soil. Raking it up, besides being unnecessary work, takes up many of the beneficial critters that help the soil too. Just add new mulch on top of the old mulch, and then you don't need as much.