You can read them, just for a small payment. Before the internet, you might have had to pay to travel to a library. Was that wrong too?
In the age of the Internet, where data storage and transmission costs are effectively $0 for basic text documents, there is absolutely no excuse for all laws and codes to be 100% public domain.
It's not as if the government has to print a physical book for every citizen.
And you're still sidestepping the issue of the codes having a cost of production like any intellectual work, in terms of deciding e.g. the optimal balance to put in terms of safety vs cost of a building code. It doesn't cost for each access, but they do have to amortize that cost, and it makes sense for the cost to be allocated toward those who do specialized work in that domain.