We take into account motivation pretty often to evaluate morality not sure why you can't apply it here
TSA's purpose is prevent harm to other passengers (effectiveness is debatable but not the point), the east German border guards were there to keep control on what information the population could access and share
They are not the same thing even if the means look the same