Two men from Gaithersburg and one from Baltimore were among nine men charged with taking part in what a federal prosecutor said was an informal network of men who regularly swap child pornography with each other across the country.

Richard S. Williams, 56, and Paul Madsen, 40, both of 29 Nancy Place in Gaithersburg, and Herbert B. Cruickshank, 61, of Baltimore were arrested along with six others by FBI agents in six states Tuesday and Wednesday, according to Jeremy Frey, an assistant U.S attorney in Camden, N.J.

He said the arrests followed a two-year investigation that began when a collector of child pornography in Woodbury Heights, N.J., agreed to cooperate with federal agents, allowing them to monitor his swapping of the material with acquaintances. He said none of the suspects was charged with producing any pornographic material.

Frey said collectors of child pornography often learn of others with similar interests, and that an informal trading network has grown over the years. Not all of the nine suspects necessarily knew one another, he said, but all shared an acquaintance in Woodbury Heights.

Madsen was charged with transporting five videotapes of child pornography from Pennsylvania to Gaithersburg between December 1986 and last month, a federal prosecutor said, and Williams was charged with transporting five similar tapes from Seattle to Woodbury Heights last month. Both appeared Wednesday before U.S. Magistrate Paul R. Rosenberg in Baltimore.

Madsen, who faces a possible 10-year prison term, was released on his own recognizance. Williams, also charged with the interstate transporation of a juvenile for the purpose of prostitution and with delivering child pornography through the mail, faces a possible 20-year term and was ordered held pending a detention hearing today.

Cruickshank, charged with twice transporting photographic child pornography between Baltimore and Woodbury Heights, faces a possible 20-year term.