thereby hangs a tale

Etymology
in "As you Like it," act 2, scene 7:
 * And so from hour to hour we ripe and ripe,
 * And then from hour to hour we rot and rot,
 * And thereby hangs a tale.