Short answer: Good pay, good results, and exciting changes on the horizon.
Furthermore, the Maryland legislature is committed to raising salaries and making Maryland into a national and international model of a good school system. In 2019, the legislature passed the "Blueprint for Maryland's Future," a bill earmarking significant public spending in three areas: Increasing teacher pay, expanding access to kindergarten, and improving education in high-poverty areas. These are the first steps towards enacting the vision laid out in a report by the Maryland Commission on Innovation and Excellence in Education (for an analysis of the implications of this report, look here. ) Maryland is already a good place to teach, and the next ten years promise to be very exciting.
Maryland also has strong teachers unions, who ensure that Maryland teachers are granted high levels of autonomy and professionalism.
Finally, Maryland colleges and universities don't produce enough new teachers to fill needs, resulting in chronic shortages. Maryland school districts prefer to hire teachers trained in Maryland, which gives graduates of Maryland approved teacher preparation programs a significant advantage in getting jobs.