It was a fairly common practice in the mid-19th Century to nail silver or gold coins in door frames for "good luck." I haven't encountered any copper
coins deliberately embedded in houses, however. Over the years, I have bought and sold a holed 1852 Type I gold dollar and an unknown date holed Carson City Seated quarter
that very likely were such "good luck" pieces.
A window would not be a likely place for such a coin. A house that old would have had windows refurbished several times over the years, lubricating pulleys, replacing sash cords and retrieving sash weights. I could see someone placing a coin in a window much later than construction, though a two cent would be an odd choice of coin.
Every date of the Two Cent series has Chinese fakes, but I am not aware of an 1864 large
motto fake. The Chinese replicas have widely spaced and elongated denticles. They generally have unevenly aligned letters in CENTS. They also have incomplete leaves, especially on the left side of the wreath. (The fake 1864 small
motto also has the wrong number of feathers on the left arrow shaft.) I don't see any of those indicators here, and the coin appears to be genuine.
It would really help to see better photos of the coin. Using a cell phone in natural light would produce better images. Would you be willing to post additional photos?