The crew are (were) paid by a crewing agency, typically providing a crew to the charterer, who finds a ship from some shipowner or other to offer freight services to commercial clients.
The shipowner is invariably located in a PO Box in a jurisdiction which makes Swiss banks seem downright extrovert; however, this is just a shell company controlled by an opaque holding company, &c.
Global shipping is a rather murky business, designed to facilitate tax and responsibility avoidance.
If this sounds interesting, investigative journalist Ian Urbina published a most informative (and scary) book on the subject last year - Outlaw Ocean.