You need to quote the entire section of the statute. I believe "by law enforcement agency" means that they are running the firing range and that the transfer of the firearm is only for the sole purpose of shooting on the range. Since Lautenberg and Miller were not on a firing range then in my opinion I believe they did illegally possess the firearms when they handled them. See below for the entire section of the statute.
"2C:58-3.1. Temporary transfer of firearms
1. a. Notwithstanding the provisions of N.J.S.2C:39-9, N.J.S.2C:58-2, N.J.S.2C:58-3 or any other statute to the contrary concerning the transfer or disposition of firearms, the legal owner, or a dealer licensed under N.J.S.2C:58-2, may temporarily transfer a handgun, rifle or shotgun to another person who is 18 years of age or older, whether or not the person receiving the firearm holds a firearms purchaser identification card or a permit to carry a handgun. The person to whom a handgun, rifle or shotgun is temporarily transferred by the legal owner of the firearm or a licensed dealer may receive, possess, carry and use that handgun, rifle or shotgun, if the transfer is made upon a firing range operated by a licensed dealer, by a law enforcement agency, a legally recognized military organization or a rifle or pistol club which has filed a copy of its charter with the superintendent and annually submits to the superintendent a list of its members and if the firearm is received, possessed, carried and used for the sole purpose of target practice, trap or skeet shooting, or competition upon that firing range or instruction and training at any location.
A transfer under this subsection shall be for not more than eight consecutive hours in any 24-hour period and may be made for a set fee or an hourly charge.
The firearm shall be handled and used by the person to whom it is temporarily transferred only in the actual presence or under the direct supervision of the legal owner of the firearm, the dealer who transferred the firearm or any other person competent to supervise the handling and use of firearms and authorized to act for that purpose by the legal owner or licensed dealer. The legal owner of the firearm or the licensed dealer shall be on the premises or the property of the firing range during the entire time that the firearm is in the possession of the person to whom it is temporarily transferred.
The term "legal owner" as used in this subsection means a natural person and does not include an organization, commercial enterprise, or a licensed manufacturer, wholesaler or dealer of firearms."