It looks like a Warner breeched parlor rifle, often called Flobert rifles because of the widely-distributed parlor rifles made by the Flobert company in the late 1800s-early 1900s. And yes, that one is beyond the point of restoration.
Why it was there is anyone's guess, but when parlor shooting went out of fashion (yes, imagine that, it used to be fashionable to shoot rifles indoors) many of these old guns were tossed in an attic or trunk or garden shed.\, where they were often discovered and appropriated by young boys, who then hid them for later recovery. Many were tossed in leaf or trash fires to dispose of them, they had little value. And many were just given away to the neighbor boys for mowing the lawn or trimming a hedge. It was a cheap gun, few people even gave it much thought.