As soon as the daguerreotype was invented in 1839, families began to take photographs of their dead. It quickly became viewed as a respectful part of the funeral ritual; and a powerful aid to mourning.
Until the latter part of the 19th century, the most common practice was to make the deceased appear as in life. They would be propped up by a hidden stand, or arranged on a chair. Children were usually laid out on a bed, as if they were merely asleep.
In order to aid this illusion, living family members and/or pets would pose with them. They would try desperately to keep the grief from their features. It would not do to give the game away.
However, as the decades went on, it was seen as more proper to give hints to the true status of the dead. Flowers covered beds, in elaborate tableaux, that could not be mistaken for a night's repose.
By the end of the 19th century, coffins were brought into view; or the deceased were pictured as they were, with no attempt made to arrange them in life-like positions.
After that, the practice slipped out of commonplace in Western society. It still did go on, but more rarely, until the fashion went away completely. Then it became taboo.