What are the rules for close/formation flying of civilian planes? Two recent questions and their answers have raised a further question.

In Are there laws about how close military aircraft can fly to passenger jets, and are they enforced?, we learned that "the military can get as close to other aircraft as they damn well please, through a procedure called Military Assumes Responsibility for Seperation of Aircraft, or MARSA".

In Why are there NASA branded F/A-18s? we see a picture of closely flying planes, and a comment notes "NASA is a civilian agency".

Do the NASA planes fly under MARSA rules or another set of rules for civilian agencies?  Are there other non-military agencies that fall under this rule too?
Pilots are allowed to fly as close as they want to each other as long as all parties agree to it and feel safe doing so.

Air Traffic Control cannot guarantee separation for planes in formation flight,So this will only be done under VFR and in VMC, where pilots can maintain visual separation from each other.

Many stunt fliers are civilian pilots and will routinely fly in close formation as well.

Other notable example of civilian formation flight include Mythbusters testing airplane fuel efficiency in formation and Airbus' publicity stunt with 5 A350s