Clifford Cain Jr., a retired electrician in Baltimore, was used to living on a tight budget, carefully apportioning his Social Security and pension benefits to cover his rent and medication for multiple sclerosis.

So Mr. Cain was puzzled when he suddenly could not make ends meet. Months later, he discovered why: A debt collector had garnished his bank account after suing him for about $4,500 the company said he owed on an old debt.

Mr. Cain said he never knew the lawsuit had been brought against him until the money was gone. Neither did other Baltimore residents who were among the hundreds of people sued by the collector, Midland Funding, a unit of the Encore Capital Group, in Maryland State Court. Some of them said they did not even owe any money, or their debt had long expired and was not legally collectible, according to a review of court records.

In any case, the Encore subsidiary was not licensed to collect debt in Maryland.

Yet when Mr. Cain brought a class action in 2013 against Midland Funding, the company successfully fought to have the lawsuit dismissed.