Why is prostitution illegal but pornography is not?

Both are exchanging sex for money.

Why is filming paid sex legal but paying for sex and not filming it illegal?