Virginia and Maryland have tax reciprocity. If you work in MD and live in VA, your wages are not subject to MD income tax. You only have to file a Virginia tax return. For tax purposes, the wages you earn in MD are considered VA income, and taxable by VA. Tax reciprocity applies only to W-2 wages, not to other types of income.
Form MW-507 is a form that you turn in to your MD employer to advise him that you are a VA resident and not subject to MD withholding. It is not a tax return form.