If a team would pick up Bogosian on waivers (they wouldn't), that's better than zero value for Buffalo. That's $5M to play with at the deadline without having to give away a contributing player. So cap space is one of the assets that makes the trade worth doing. They have to value a rental Toffoli and they have to value the potential to add another player at the deadline. If they don't see themselves doing either of those things -- basically, if they'd rather ride the season out with the current roster and build for next year -- they don't do this deal.
If they do value a rental Toffoli and if they do value the space to make a move at the deadline, this is a very reasonable deal for both. A late first for a fourth, a middle six winger, and $3M of space is a good package.
There's not really another player as expendable and as expensive as Bogosian on the roster. They can't add a player for picks at the deadline without shedding salary, and there's no salary they'd rather shed than Bogo's.
And since they drafted Johnson, recall they traded for Jokiharju (and, to a lesser extent, Miller). They may look at this guy differently knowing that the D of the future includes Dahlin, Joker, Montour, Pilut, Risto, Borgen, and Samuelsson already.