The letters asked for the information “in lieu of subpoena” but strongly suggested that subpoenas might follow if the requests were not fulfilled.

A banking trade group and the Office of the Comptroller of the Currency brought suit to block Mr. Spitzer’s request, contending that the National Bank Act and rules issued by the Bush administration in 2004 gave that kind of law enforcement authority to the comptroller and prohibited such efforts by the states. A federal district court ruled against the states, and the United States Court of Appeals for the Second Circuit affirmed the lower court’s decision.

Writing for a 5-to-4 majority, Justice Antonin Scalia concluded that the attorney general had not been engaged in the broad “visitorial powers” reserved by the federal government, in which the government acts like a supervisor with free access to bank records on demand. The court, he wrote, has always understood that visitorial powers are “quite separate” from the power to enforce the law, and the attorney general was acting in the role of “sovereign-as-law-enforcer” in seeking the information.

Normally, Justice Scalia wrote, the court would defer to an agency’s interpretation of the law when the terms in dispute are ambiguous. But in this case, which turned on such terms as “visitorial powers,” he stated that even though the term was “somewhat ambiguous,” the court could discern “the outer limits” of the term, “even through the clouded lens of history.” The meaning that could be wrestled from the phrase, Justice Scalia wrote, did not include restrictions on “ordinary enforcement of the law” by the states.

Image Justice Antonin Scalia, top, wrote the majority opinion against the banks position. Justice Clarence Thomas wrote the dissent. Credit... J. Scott Applewhite/Associated Press

The decision brought together an unusual coalition. Justice Scalia, one of the court’s most conservative members, was joined by the court’s more liberal wing of John Paul Stevens, David H. Souter, Ruth Bader Ginsburg and Stephen G. Breyer.