Neither are lots of the essential functions of organized society. OTOH, universal access to a complete and accurate account of the law is arguably is an essential element of government of, by, and for the people.
> Best solution would likely be to have three non-profits take compete to provide access; otherwise you end up with situations like this were the states outsource access it an attempt to reduce costs and make money too.
I don't know that that's the "best solution"; a national rule that no government act has the force of law until and unless published in an official, universally and freely accessible, public domain, repository of the law meeting defined standards that include provisions relating to functionality and exportabilitym would not prevent states from outsourcing the work of providing the online repository, but would prevent it from being put behind a copyright wall preventing free use, and would prevent technical barriers from being erected to effective use in order to advance commercial interests, and would prevent it from being a way to make money rather than a way to provide free and equal access to the most fundamental information about government -- what their official, binding decrees are.
Compare to the alternative of uploading one copy to Public.Resource.org or the Internet Archive. It's probably cheaper for the courts to do this than to provide copies to 3 non-profits for further sale.
Edit: add Public.Resource.org, since they're in the forefront of making the Law available for free.
Other countries manage to have laws available online in dozens of variations and translations, like http://www.gesetze-im-internet.de/
And thanks to that, volunteer efforts like https://github.com/bundestag/gesetze#german-federal-laws-and... can be possible and legal.
Why does US law have to be costly?
Because it is seen as a business opportunity. Essentially, capitalism.
In this case, saying "this isn't capitalism, it's rent-seeking" is like saying, as you sail out of the Golden Gate, "this isn't the ocean, its salt water."
(That is, its wrong because the thing being described is both the thing it is denied to be and the thing it is proposed to be instead, and the latter is central characteristic of the former.)
cap·i·tal·ism ˈkapədlˌizəm/ noun
"an economic and political system in which a country's trade and industry are controlled by private owners for profit, rather than by the state"
Rent-seeking is orthogonal to capitalism. You can (and do) have rent-seeking in non-capitalist economies too.
And, not only are public domain works not copyrightable, they're none-the-less very available, almost always for free. Making it copyrightable does nothing to help provide access to the content, and everything to hinder it.