Self-hosted social networking software gives you the parts of a Facebook group that matter to a membership organisation: profiles, connections, groups, an activity feed, private messages and file sharing, all running on hosting you control, with a member list nobody else can switch off. The two applications here solve that in completely different ways, and the difference decides your hosting before you have written a word of copy.
BuddyPress is a WordPress plugin, not standalone software. It adds member profiles, groups, friendships and activity streams to a WordPress site you already run, which is how it reached more than 90,000 active installations. Version 14.5.2 is current. Its hosting profile is simply WordPress's hosting profile: PHP, MySQL, and the same theme and plugin stack you already look after. Elgg is the opposite proposition. It is a standalone social networking engine, currently at 7.0.5, and it sits closer to a framework than a finished product. Elgg 7 wants PHP 8.3 or newer, is happiest installed with Composer, and expects its data directory to live outside the document root.
The commercial comparison is Circle, which lists its Professional tier at US$89 a month plus transaction fees on anything you sell, Mighty Networks, Discourse where the community is mostly discussion, and a Facebook group if you are content renting the audience. Self-hosting drops the monthly platform fee, and more importantly keeps the member records and email addresses in a database you can export whenever you like.