Updated

The Supreme Court ruled Monday that federal law does not allow someone to buy a gun for someone else even if both are legally eligible to own firearms.

The 5-4 ruling on so-called straw purchasing came down in the case of Bruce James Abramski, Jr., who bought a Glock 19 handgun in Collinsville, Va., in 2009 and later transferred it to his uncle in Easton, Pa.

Federal officials brought charges against Abramski because he assured the Virginia dealer he was the actual buyer of the weapon, even though he had already agreed to buy the gun for his uncle.

The high court ruled that the federal background check law does apply to Abramski, rejecting Abramski's argument that since both he and his uncle were legally allowed to own guns, the law shouldn't have applied to him.

"We hold that such a misrepresentation is punishable under the statute, whether or not the true buyer could have purchased the gun without the straw," the court ruled.

Writing for the majority, Justice Elena Kagan said the federal government's elaborate system of background checks and record-keeping requirements help law enforcement investigate crimes by tracing guns to their buyers. Those provisions would mean little, she said, if a would-be gun buyer could evade them by simply getting another person to buy the gun and fill out the paperwork.

Kagan's opinion was joined by Justice Anthony Kennedy, who is often considered the court's swing vote, as well as liberal Justices Ruth Bader Ginsburg, Stephen Breyer and Sonia Sotomayor.

In dissent, Justice Antonin Scalia said the language of the law does not support making it a crime for one lawful gun owner to buy a gun for another lawful gun owner. He was joined by the court's other conservatives -- Chief Justice John Roberts and Justices Clarence Thomas and Samuel Alito.

The Associated Press contributed to this report.