A high-margin and fast-growing ad business is changing the chain’s relationship with brands.