Germany can deny benefits to jobless EU migrants, court rules