If pedophila is a mental illness then why are pedos sent to jail and not psychiatric institutions?

 
They would put a schizophrenic murderer in an institution so why is it any different with this? If it's a mental illness then wouldn't they lack the mens rea? Where do you draw the line?