The Patent and Trademark Office is completely fee-based and for years and years was subject to “fee diversion” to the general fund. I think the number was typically 10% of the $1-2 B budget was “profit.”
For the past 5-6 years the white house’s annual budget have stopped the practice of fee diversion, but it is completely at the whim of the president.