The Massachusetts Division of Banks said Wednesday that new regulations will prevent national and state lenders from foreclosing on a homeowner’s property if modifying their mortgage loans cost less.

The regulations, a product of legislation signed by Governor Deval Patrick last August, require lenders to consider all available loss-mitigation options before proceeding to foreclosure. After several months of drafting, the regulations have now just gone into effect.