The primary gun on a merchant ship was
always mounted aft so that it could still claim the privilege under international law of being a non-combatant
although armed for its own protection (i.e. '
defensively equipped'). Having the main gun forward would enable it to act aggressively and it could then be regarded as an armed merchant cruiser (warship) which could be sunk without warning. Just because Germany eventually discarded observance of the Prize Regulations didn't mean they weren't still technically in force. Sometimes the lines got a little blurred but the Allies won the war and had better lawyers.
Many ships, especially those of wartime build, had an extensive battery of guns but those mounted forward were primarily for anti-aircraft defence, although the larger ones could still put holes in your U-Boat.
In 1942 a Liberty ship '
Stephen Hopkins' damaged a German surface raider so badly that the raider later exploded and sank

.
KH