How the law soothed broken hearts in 19th-century America