In my eyes, the reason much of the public sector is unproductive is not because it is not motivated by profit. But rather that it is too similar to large companies with loads different management-levels.
I once worked in the public sector when they embraced real autonomous teams with leaders that could actually make decisions when the team needed it. It was just as efficient as the best agile teams I have worked at in the private sector.