Since newspapers were the best and (sometimes, only) method of communication, they could afford to charge what they wanted. Additionally, newspapers have to print out obituaries when they're published. This means paper, ink, and time go into the total cost of an obituary being published.