Police: Lancaster man accidentally shot, killed while buying gun