Any city or town, however organized, may incorporate in an ordinance by reference any statute of Minnesota, any administrative rule of any department of the state of Minnesota affecting the municipality, or any code. Any such municipality situated wholly or partly within 20 miles of the limits of a city of the first class may similarly adopt by reference any ordinance of such first class city or of any contiguous first class city regulating the construction, alteration, improvement, repair, or maintenance of buildings or the installation of equipment therein. All requirements of statutes and charters for the publication or posting of ordinances shall be satisfied in such case if the ordinance incorporating the statute, rule, ordinance or code is published or posted in the required manner and if, prior to such posting or publication, at least one copy of the ordinance or code is marked as the official copy and filed for use and examination by the public in the office of the municipal clerk or recorder. Provisions of the statute, rule, ordinance or code thus incorporated in such ordinance by reference shall be as much a part of the ordinance as if they had been set out in full therein. The clerk or recorder of the municipality shall furnish a copy of any such ordinance thus incorporated by reference at cost to any person upon request. This section does not authorize any municipality to adopt ordinances on any subject on which it does not have power by statute or charter to legislate. The term "code" as used herein means any compilation of regulations or standards or part thereof prepared by any governmental agency, including regional and county planning agencies or any trade or professional association for general distribution in printed form as a standard or model on the subject of building construction, plumbing, electric wiring, inflammable liquids, sanitary provisions, planning, zoning, subdivision, housing, public health, safety, or welfare.