Yes. This is legal. See, e.g. SPARF v.U.S. 156 U.S. 51 (1895); U.S. vs Moylan, 417 F 2d 1002, 1006 (4th Cir. 1969); U.S. v. Krzyske, 836 F.2d 1013 (6th Cir. 1988) ("the jury asked the judge about jury nullification. The judge responded, "There is no such thing as valid jury nullification." The jury convicted the defendant. On appeal, the majority and the dissent agreed that the trial judge's instruction was untrue, but the majority held that this false representation was not a reversible error.").
Indeed, procedurally, the system is specifically designed to prevent courts from even considering such a question.
See also, e.g. People v. Iannicelli, 2019 CO 80, § 2 (Colo. 2019) (holding no crime was committed) ("Defendants Mark Iannicelli and Eric Brandt stood in the plaza square adjacent to the Lindsey-Flanigan Courthouse in Denver and asked people entering the courthouse whether they were reporting for jury duty. If any of these people answered affirmatively, then Iannicelli and Brandt would hand them one or more brochures discussing the concept of jury nullification, which the brochures defined as the process by which a jury in a criminal case acquits the defendant regardless of whether he or she has broken the law in question. As a result of this conduct, the People charged Iannicelli and Brandt with multiple counts of jury tampering")
This is deeply entwined with the U.S. law interpretation of the Fifth Amendment Double Jeopardy Clause's protections, which prohibit a retrial or appeal following a judgment of acquittal, which have been incorporated by the U.S. Supreme Court as applicable in state courts as well.