Under such regulations as the Secretary of the Navy prescribes, uniforms, accouterments, and equipment shall be sold by the United States at cost to officers and midshipmen of the naval service and, when the Coast Guard is operating as a service in the Navy, to officers of the Coast Guard.