Whenever land within a subdivision granted final approval is used in a manner or for a purpose which violates any provision of this chapter, any provision of the local subdivision regulations, or any term or condition of plat approval prescribed for the plat by the local government, then the prosecuting attorney, or the attorney general if the prosecuting attorney shall fail to act, may commence an action to restrain and enjoin such use and compel compliance with the provisions of this chapter or the local regulations, or with such terms or conditions. The costs of such action may be taxed against the violator.