Maryland students seem to like it there despite the tiered p/f grading system (I know some students there currently). However, if grading structure is something that's really important to you, then maybe the sacrifice of the money is worth it. 40k is a lot of money but also not in the grand scheme of things, and if it's worth your mental health then go for it. If it were closer to 100K I would say it isn't worth it.
Also, if family being closer is more important than the grading system, then it's an easy answer and go with UMD. Just depends on how much you weigh each pro/con. Just my two cents