Federal courts, including the U.S. supreme court refuse to hear cases for lack of jurisdiction all the time. As in, many times every day.

At the Supreme Court, one place to see this is in the doctrine of adequate and independent state grounds, that applies when reviewing decisions of a state's highest court. Here is the Wikipedia page on that concept with several citations: https://en.wikipedia.org/wiki/Adequate_and_independent_state...

For other federal courts, one relevant concept is "federal question jurisdiction." (So called, because raising a "federal question," is synonymous with presenting a case that arises under the "laws of the United States.") Here is a classic case on that issue (though it is much more complex than necessary to prove the present point.) Tennessee v. Union and Planters' Bank, https://supreme.justia.com/cases/federal/us/152/454/case.htm...

Here is a relevant quote (though if you really want to learn how this all works, I recommend reading the entire case carefully):

> "We find it unnecessary to consider other objections to the maintenance of these three bills, or of any of them, because we are clearly of opinion that each suit is not one arising under the Constitution and laws of the United States, of which the circuit court of the United States has jurisdiction, either original, or by removal from a state court, under the Act of March 3, 1887, c. 373, as corrected by the Act of August 13, 1888, c. 866. 25 Stat. 434."

And here is a more quotidian example: Lake v. Malone, No. CA 3:11-824-CMC-PJG, 2011 WL 2162711, at 2 (D.S.C. May 6, 2011) report and recommendation adopted, No. CA 3:11-824-CMC-PJG, 2011 WL 2162159 (D.S.C. June 1, 2011)

> “This case is subject to summary dismissal because the allegations contained in Plaintiff's Complaint do not fall within the scope of either form of this court's limited jurisdiction, and there is no other possible basis for federal jurisdiction evident from the face of the pleading. There is no viable federal question alleged and there is no apparent diversity of citizenship between the plaintiff and the defendants.

> Generally, a case can be originally filed in a federal district court if there is “federal question” jurisdiction under 28 U.S.C. § 1331 or “diversity of citizenship” under 28 U.S.C. § 1332. Federal courts are courts of limited jurisdiction, “constrained to exercise only the authority conferred by Article III of the Constitution and affirmatively granted by federal statute.” In re Bulldog Trucking, Inc., 147 F.3d 347, 352 (4th Cir.1998). Since federal courts have limited subject matter jurisdiction, there is no presumption that the court has jurisdiction. Pinkley, Inc. v. City of Frederick, 191 F.3d 394, 399 (4th Cir.1999) (citing Lehigh Mining & Mfg. Co. v. Kelly, 160 U.S. 337 (1895). Accordingly, a federal court is required, sua sponte, to determine if a valid basis for its jurisdiction exists, “and to dismiss the action if no such ground appears.” Bulldog Trucking, 147 F.3d at 352; see also Fed.R.Civ.P. 12(h)(3) (“Whenever it appears ... that the court lacks jurisdiction of the subject matter, the court shall dismiss the action.”). “[T]he facts providing the court jurisdiction must be affirmatively alleged in the complaint.” Davis v. Pak, 856 F.2d 648, 650 (4th Cir.1988) (citing McNutt v. General Motors Acceptance Corp., 298 U.S. 178, 56 S.Ct. 780, 80 L.Ed. 1135 (1936)). To this end, Federal Rule of Civil Procedure 8(a) (1)requires that the complaint provide “a short plain statement of the grounds upon which the court's jurisdiction depends[.]” If, however, the complaint does not contain “an affirmative pleading of a jurisdictional basis, the federal court may find that it has jurisdiction if the facts supporting jurisdiction have been clearly pleaded.” Pinkley, Inc., 191 F.3d at 399 (citing 2 Moore's Federal Practice § 8.03[3] (3d ed.1997)). Although the absence of subject matter jurisdiction may be raised at any time during the case, determining jurisdiction at the outset of the litigation is the most efficient procedure. Lovern v. Edwards, 190 F.3d 648, 654 (4th Cir.1999). If the court, viewing the allegations in the light most favorable to the plaintiff, finds insufficient allegations in the pleadings, the court will lack subject matter jurisdiction. Id.”

By the way, you're right in one small, interesting respect: "laws of the United States" does not just refer to the U.S. Code. It also refers to federal regulations, federal common law, state-law claims bound up in the same dispute as a federal-law claim where the state-law issues do not predominate, and the very rare state law issue that raises significant federal interests. As you can see, lawyers and judges have given this phrase a lot of thought over the years. And don't forget that Art III does also allow cases under state law to be brought in federal courts when the litigants are from different states. But you remain quite wrong that Art III, and the term "laws of the United States," refers to all laws in the United States, whether state of federal, as the two cases above clearly demonstrate. If I were wrong about this, I would have done very poorly in my Federal Courts class in law school.