If so is the law exactly the same in both instances?
The actions that constitute patent infringement do not depend upon whether or not the infringer is a nonprofit or not.
Disgorgement of profits is one possible remedy for patent infringement, and if the entity made less profits than a for profit company might have under similar circumstances, from the infringement, that particular remedy would be likely to be smaller. But, this would not preclude other remedies such as a reasonable royalty or profits lost by the patent holder due to reduced sales, or injunctive relief.