Older people will likely remember the older way credit cards were handled.
Carbon copy forms were the de facto method of proving to the credit card processor that you in fact did have the physical card present. Not only was it faster, but allowed for a very unique process to capture the credit card details.
This process involved the card, a carbon copy form, and a device with a sliding weight. The clerk would place the credit card on the device, overlay the carbon copy form on top, then slide the weight over top from one side to another. Any raised type would be captured, which included the customer information, and more critically the card number and expiry.
When the internet eventually came around, and phone transactions proved to be much more common place, CCV2 was used for these "card not present" transactions
These "2nd generation" CCVs were introduced to curb credit card theft, as it introduces a "something you have" for online/phone transactions. A malicious store clerk can't simply double swipe your card to clone it. Copying down the number becomes obvious, and can't be done with sliding the card through a reader. You can think of it as a simple PIN, tying a true card holder to the card in question. Only the card holder should have/know the CCV.
On to the major question, why do some credit cards have it on the front, where as some have it on the back?
There doesn't seem to be any standard to this, and seems to be a preference of the credit card issuer.
Visa will have the CCV on the back, and does make some sense. On first glace, someone can't see the security code without flipping over the card. There are countless cases of people taking a photograph of their card to "show off". On a AMEX, the CCV code is on the front, and this would prove disastrous. Do you recall the old method of capturing credit card details? Nothing on the back of the card was captured, this includes the CCV.
In reality, it doesn't really matter where the number is. If you have access to the physical card, you have the ability to view the CCV, no matter where on the card it is placed. Placing it on the front is more convenient as all the relevant details are in one place.
Credit card signatures are another demonstration, a bit less "technical" of security. Can you honestly recall the last time someone verified your signature against that on the card? How many people do you know have their cards unsigned? Arguably this is more secure than a CCV, but does require the card holder to be present with the card.
The future seems to hold that "rolling" CCVs are the next thing. Changing at a set time (every hour), these would prove to be much more secure than current offerings.