A federal appeals court in Philadelphia barred the Defense Department from withholding funds from colleges that deny access to military recruiters. The court ruled 2-1 that a federal law known as the Solomon Amendment infringes on the free-speech rights of schools that have restricted on-campus recruiting because of the military’s ban on lesbians and gay men. Ruling in a lawsuit brought by students and professors at New Jersey law schools, the panel said that by threatening to withdraw federal funds from schools, the government is compelling them to take part in speech they do not agree with. Similar lawsuits have been filed elsewhere, but Monday’s ruling represented the first time a court blocked enforcement of the law.