The ruling on Monday upheld a lower court’s judgment in April that the Trump administration could not drastically slash funding from the National Institutes of Health.