Jose Gomez sued a company over an unwanted text message, and he thought it might make a good class-action suit if there were others like him. The company rolled over, offering to pay Gomez every dime to which the law entitled him for the violation — $1,503 — and said that made his lawsuit moot.

Here’s one way to look at the case, which found its way to the Supreme Court on Wednesday.

“You’re being given everything you want,” Chief Justice John G. Roberts Jr. said to Jonathan F. Mitchell, the attorney for Gomez, adding “You won’t take yes for an answer.”

And here’s another:

Gomez may or may not have gotten everything he wanted, Justice Sonia Sotomayor said to Gregory G. Garre, who was representing Campbell-Ewald Co.

“But they’re entitled to have the court say it, not you.”

The rest of the argument went pretty much that way, too.

The usually conservative justices wondered why courts should waste their time refereeing a fight in which one side has thrown in the towel.

The usually liberal justices were on guard about a case that could limit a plaintiff’s ability to get into court and that could potentially hinder class-action suits.

In 2006, Campbell-Ewald, under contract with the Navy, developed a plan to send text messages to 150,000 adults ages 18 to 24 from an “opt-in” list of cellphone numbers.

But one was sent to Gomez, 40 at the time, who had not consented. “Destined for something big?” it asked. “Do it in the Navy. Get a career. An education. And a chance to serve a greater cause. For a FREE navy video call” and it listed a number.

Gomez sued under the Telephone Consumer Protection Act, which forbids unwanted solicitations, and styled his suit as a class action.

Campbell-Ewald offered Gomez all the money he could receive under the law. When Gomez declined to respond to the offer, Campbell-Ewald asked a court to dismiss the case, saying it was moot.

A district court dismissed the case, but a panel of the San Francisco-based U.S. Court of Appeals for the 9th Circuit reversed the decision, saying the case was not moot.

Garre told the justices that agreeing with Gomez would allow a plaintiff “to force a court to adjudicate the merits of his claim simply by refusing the defendant’s offer of capitulation and complete relief.”

But Garre was immediately grilled. What about attorney’s fees? asked Justice Elena Kagan. What about a declaration of liability by the company? asked Sotomayor.

Justice Ruth Bader Ginsburg said that under federal rules, refusing the settlement offer by the company did not end the case.

The company cannot say it has offered Gomez complete relief “because in his view, you haven’t offered complete relief, and that’s what the litigation is all about,” Kagan said.

The conservatives worked over Gomez’s attorney, Mitchell, who said that “even if the plaintiff and the defendant agree on what the proper judicial relief should be, the only question in that situation is whether the court should enter judgment for the plaintiff, not dismiss the case for lack of jurisdiction.”

What about the court’s interest in not wasting its time? asked Roberts.

What if Garre “were to take a big stash of cash out of his briefcase” and pay Gomez, asked Justice Samuel A. Alito Jr. Would that end the case?

The chief justice noted that Gomez’s real interest might be a bonus he would receive if he were the lead plaintiff in a class-action suit.

Justice Stephen G. Breyer expressed interest in a compromise: The company gives the settlement to a court, which in turn offers it to the plaintiff. If the plaintiff doesn’t accept, the court can dismiss the case.

“He gets judgment on the merits in those situations,” Mitchell said.

“Fine. Give him judgment on the merits,” Breyer replied. “Who cares?”

The case is Campbell-Ewald Co. v. Gomez .