Why do funding agencies like the NSF not publish accepted grants?
Why do funding agencies like the NSF not publish accepted grants?
  
  Has the NSF ever published a justification for not publishing accepted proposals online?


While it is correct in a technical sense that the NSF "does not publish accepted proposals online", I think this framing of your question is a bit misleading. The NSF has a process for allowing the public to access awarded proposals. This process, based on the Freedom of Information Act, is designed precisely to balance the public's need for transparency in government spending with other important things, such as the government's need to function properly (which is why even FOIA won't gain you access to top secret military information, for example), and the completely legitimate desire of researchers to pursue their research plans on their own timeline without undue stress or fear of having their ideas scooped and exploited by others.


  Some good reasons for publishing these proposals are:
  
  
  It increases transparency, so that the public directly knows what was funded with tax payer money.
  


As I was saying above, the key word here is "balance". You can't have maximal transparency, because all sorts of things would go wrong if you try to have it - researchers would protest loudly, and/or eventually start including less and less useful details in their proposals, making the evaluation process more difficult and the outcomes less meritocratic; and/or eventually seek alternative funding sources or try to get by without NSF support, with detrimental results to their research. On the other hand, no one is advocating for complete secrecy either - note that the current system is already a compromise between privacy and transparency: researchers do understand that their proposals will be reviewed by a panel of experts in their fields, and accept whatever small risk of scooping/misuse of ideas may exist given this situation. Writers of proposals also understand that in the end their proposals can in fact be looked up by curious members of the public, journalists, and people in Congress, who may end up accusing them of wasting government money on useless research or other unpleasant things. Everyone accepts that when you take public funding it comes with some strings attached, including a certain amount of public exposure and some level of disclosure of your research ideas. So again, I think your framing of the question is slightly loaded, as it risks painting an exaggerated picture of the grants process as being shrouded in secrecy, and of researchers as somewhat paranoid people who are always fearful of having their ideas stolen. The truth is much more balanced and reasonable than that.


  
  It would help future PIs find example successful proposals in order to create better proposals. The current system of asking friends for copies of their proposals is super frustrating and seems like it is likely fostering an atmosphere of cronyism.
  


I am not aware of any "system" of asking friends for copies of proposals. That's something that some people do and others don't (I didn't). And calling it "cronyism" seems like a huge stretch. In fact, I think it's rather the opposite; from my experience with the grants process (including serving on several NSF panels), while the grants process is far from being without flaws, it is as meritocratic a system as anyone has been able to come up with for a complicated process of handing out several billion dollars a year to many thousands of people based on a very messy and noisy dataset. And yes, it's true that the process is very competitive and can be frustrating for many people. That would remain true even if all awarded proposals were made publicly available.


  Has the NSF ever published a justification for not publishing accepted proposals online?


The NSF page I linked to above offers an explanation of how to request access to proposals, and what kind of access will be granted:


  National Science Foundation policy is to make the fullest possible disclosure of information, subject to restrictions imposed by the Freedom of Information Act (FOIA) and Privacy Act, to any person who requests information, without unnecessary expense or delay. [...]
  
  Copies of awarded proposals are available upon request, there may be applicable fees. Personal and proprietary information will be removed from the proposal documents before they are released.


The reference to personal and proprietary information provides some justification for why the process works the way it does.