You can have sex with a minor if (A) both participants are minors, (B) the adult and minor are within 3 years of age, or (C) the age of consent is below 18.
However if you photograph or videotape "the act" then you have committed a crime.
Somehow taking a picture of it is worse than actually doing it. Except as you note when it comes to paying a person for sex...
----
Society knows right from wrong but tries to make excuses for bad behavior.
Which brings up the new and interesting use of child pornography laws: prosecuting children who take nude pictures of themselves. It's happened a number of times recently. Be it right or wrong to prosecute them, it's still completely bizarre. :-)