The phrase ¡No manches! is quite common here in Mexico, and it's easy to tell from context when it ought to be used (similar to "No way!" in English), but what does it literally mean? And where is this phrase used?
The previous answers are missing an important point. It is very common in Mexico to take an expression (often a vulgar one) and replace an offending word with a similar-sounding one. This is akin to americans that shout "sugar!" when the hammer their thumbs. Thus, for instance, "caramba" is a nonsense word that replaces "carajo".
As explained by others, "no manches" can mean "no way" and "don't behave like that". Both meanings correspond also to the expression "no mames", but buy using the similar-sounding word "manches" the intention used to be to soften the expression.
No manches can be used in the following contexts:
P1: Iba caminando por la banqueta cuando de repente me encontré un billete de $500 tirado.
P2: ¿No manches?
This could be replaced with another popular phrase: ¿En serio? (Really?)
Another use would be:
P1: (P1 approaches his car and sees that it has been hit) ¡No manches!
P2: ¿Qué pasa?
P1: Alguien golpeó mi carro. Mira.
The meaning of this one is like: ¡No puede ser! (This can't be happening!)
The literally meaning of "No manches" comes from the verb "manchar": (RAE)
(Del lat. maculāre).
- tr. Poner sucio algo, haciéndole perder en alguna de sus partes el color que tenía. U. t. c. prnl.
"No manches" is interchangeable with another popular Mexican expression: "No mames". "No mames" is even more informal and "mames", from the verb mamar, is also considered a bad word.
Remember to not use these expressions in formal conversations.