My perspective was from a small business private lender rather than RE lending, but the mechanics were largely the same. What I have seen is an internal sales team (AE's/Reps who split their time between referral partner development and managing their pipeline) combined with someone solely responsible for digital marketing (social media, SEO, ppc). This dealflow is then supplemented with deals from the broker channel.
The broker channel will get leads in the door quickly, but they are usually of questionable quality and loyalty. We had to work out some metrics for how to vet and when to offload brokers because we would get spammed with trash deals or be competing with five other lenders whom the broker was pitting against one another. The dealflow from brokers is always there, but the juice vs squeeze conundrum is in full force because if you dont manage this closely, you will start soaking up tons of bandwidth and payroll with underwriting several deals for only 1 in 5-10 to actually close. Also, these deals tend to have very thin margins because the brokers will soak up a lot of the up front pricing while also pressuring you to get skinny on the rate. EPO's, PPP's, and clawbacks are critical to manage this as well.
Going direct to client is the holy grail but is more difficult. Usually an originator/AE will develop referral partner relationships and rely on SOI to bring the leads in while also managing their pipeline. The mortgage world also mostly runs on this model for smaller to midsize orgs. Typically AE's will be commission only or commission + a small base. Normal comp is 100-150 bps on volume for these roles if commission only and completely self-generated leads. For lender provided leads, half of this is the norm.
Social media and SEO works, but you have to really niche and be strategic. Typically its the behemoths with huge marketing budgets who do well with this. There is definitely an economy of scale aspect to this. Generally what I have seen for smaller orgs (under $1B in volume) is that it's far more effective to bring in originators than to throw money at paid digital marketing. You have to really understand your funnel and market segment as well as execute extremely well for this to work.