Faculty member at a top-tier CS school. For most of the faculty where I am, an hourly consulting fee in the range of $500-1000 is reasonable. If you take the low-end of that range ($500) x 3 hours of class time per week ($1500) x 12 weeks of class you get $18,000 worth of expert time. Multiply that by three classes and you get $54k of value each semester, so even with non-trivial tuition it is still a pretty good deal. Likewise, FAANG et al recruit very heavily from our school so there is additional value-add.
I personally came from modest means and have a ton of outstanding student debt and was hesitant to go the faculty route precisely because I think the higher education in the US can be financially exploitative, but there are places where the high tuition is in fact a bargain based on market rates for the expertise. Likewise, nearly all faculty at top-tier CS schools can make way more in the private sector - we do this job because we really enjoy mentoring and work hard to make sure our students get the best education possible.