NASA scientists are actually quite a bright bunch of people and knew that there would be no wind on the moon (hence no flag waving) so they build the flag pole with pole running through the top of the flag to hold it up. As the astronauts moved the flag pole into position the flag would wave about and without any wind resistance continued to do so for some time.
Number 5 on the environment section of the wikipedia page on the moon landing conspiracy provides the answer along with every other debunk.
Going off topic a little, the set they built when they tested for lighting and shadows was ^%$*@## brilliant, would love to of been a kid when they done that. Also Kari byron is super hot.