When I join two objects with logic, the logic from one is lost
As far as I know Blender does not support merging logic bricks. It can completely replace it via a copy command. 

As mentioned by Duarte Farrajota Ramos merging meshes does not care logic bricks.

I think it is possible via Blender Python. But I do not know if anyone ever created such an add-on.