The majority of ICC’s revenue comes from program services, including consulting, certification, and training, which do not rely on profiting by limiting access to the law.
In addition, the laws are written by volunteers. ICC convenes committees of volunteers who author the law. That's how the run such huge profit margins.
EDIT: Disclaimer - As stated in a couple other spots on this page, I am a cofounder of UpCodes.