Newspapers charge to publish your obituaries because they’re trying to make money. They could sell the space to advertisers. Or print another news story. You can publish your obituary in the newspapers print or online editions.
The funeral home handling the arrangements will often publish the obituary on their website as part of their service.
Other people use their social media channels to announce the death of a loved one.