Who owns the system and the data?

Your data is always yours. Ownership and licensing of the code are set out clearly in the project agreement before work starts, so there are no surprises later.