More likely than not, it's because of a hardware failure with the back camera. It seems to be a somewhat common issue with the Maxx, though it never happened to mine and I'm sure the majority of phones are fine.
You can try wiping the cache partition, restarting on safe mode to rule out a conflict with another application, or even a factory data reset (which, as the name suggests, erases all of your apps and data to start the phone from a factory fresh condition) to see if the camera works. But I'm afraid you'll find that the camera will either be flaky or won't work at all.
Clear cache partition :
https://motorola-global-portal.custh...p/30,6720,8882
Safe mode:
Press and momentarily hold the Power button (located on the right edge, above the volume buttons) until options menu appears then release.
Touch and hold Power off until the 'Reboot to safe mode' screen appears.
From the Reboot to safe mode screen, tap OK.
Note: Allow up to a minute for the device to reboot.
Notes:
With Safe Mode enabled, test device and app functionality. If the previous issue fails to occur, the cause has been isolated to a third-party app and all recently installed or updated apps should be uninstalled.
Power cycle the device to disable Safe Mode, reinstall then test each app, one at a time, to identify which is causing the problem.