This procedure has been in place for as long as I can remember. I regularly used all four spare jumpseats to carry standby pax on the 767 when people were taking companions on long haul trips. To this day, my UK AOC operator has priority system in place that allocates the jumpseats in accordance with the operating crew members start date. In fact, an overbooking trial was run a few years ago whereby passengers would be compensated if they accepted the J/S.
There is nothing illegal about this when carrying either standby or full revenue passengers. Immoral maybe, but not illegal.