Because these actually improve the project.
a code of conduct tends to improve projects when having one can help attract additional people to the project, or keep people there.