DanielBT asked a couple weeks back about this, and it took a bit to round up some good examples to share.
Let's start by going back to an era when you could only get comics from a newsstand. The guy running the newsstand was getting hundreds of periodicals on a continual basis, almost all of which were running on different schedules. Some came in daily, some weekly, some monthly, some bi-monthly, some quarterly... In the days before computers, this would be an incredible amount of work to keep track of what came in when. And it was important to keep track of that because most periodicals were sold to retailers on a returnable basis. That is, if the retailer didn't sell everything he ordered in a given timeframe, he could return them to his distributor for a refund.
Naturally, though, this wasn't a completely open-ended arrangement. You couldn't return something, for example, a year after it was published and expect anything back. You had a window of maybe a couple of months at most, depending on the frequency of the periodical.
Now you'd think that since most periodicals post their publication date on the cover, this wouldn't be an issue. The December 15th issue of the New York Times came out on December 15, right? With magazines and comics, though, publishers frequently tried to look more current than they actually were. So they'd print a date somewhat later than when the book actually went on sale; a book that was actually published in January would have a February date and would (theoretically) look more current than the other magazines next to it with the actual date.
(This got out of hand eventually, and you'd have comics' publication dates off by 6-8 months!)
So to keep track of when comics ACTUALLY hit the newsstands, retailers would literally write the date it came out right on the cover. Here's a copy of Fantastic Four #1. It's cover dated Novemeber 1961, but you can see the "8/9" clearly written on there, indicating it really hit the stands on August 9th.
Writing on each and every issue was a bit tedious, though, and retailers no doubt complained to their local distributors. What many of the regional distributors started doing was slapping a bit of paint across the top edge of the comic. So, now, instead of having to make note of the actual date, the distributors could just say, "We're accepting returns on all red-coded books." As they'd change the color with each shipment, it became easy for a retailer to just scan through his inventory and pull out any comics that had a bit of red (or whatever the color was for that week) on the top. Take a look at the top of this Machine Man #10 where you can see a bit of red splotching above the "Marvel Comics Group" banner.
Not coincidentally, I expect, the color bars ceased around the same time when publishers began emphasizing the collectibility aspect of their books with foil, die-cuts, embossing, and the like. It was part of a general realization that their comics were no longer going to a mass audience, but almost exclusively to people who were collecting them. But that's another set of issues entirely!
I hope that answers your question, DanielBT.