Could an action be moral, even uplifting, but illegal?
On close inspection, almost all law is immoral, at many different levels.
Consider that the holocausts of World Wars 1 & 2 were legally sanctioned by all governments involved.
Consider that our laws sanction a market based values system which is internally incentivised to deny the most basic survival needs to a significant fraction of the human population.
In terms of morality, in terms of choosing life and liberty of individuals as one’s highest values – all individuals, above all else, most of the laws in most jurisdictions are specifically and explicitly designed to make it extremely difficult to achieve in practice.
In a very real sense, the very concept of law, as a restriction on freedom, is immoral.
So continuing in the spirit of OM, yes – most certainly laws can be immoral, and in fact most are, but very few people are willing to explore far down that path, because is it a very uncomfortable place to go, and not many people are willing to sustain that level of discomfort for long.