The charges marked a rare instance of President Trump’s Justice Department accusing a federal agent of breaking the law while on the job.