When I needed a battery for my 990, the one the dealer had was $249! Honda had the same Yuasa in stock, minus the KTM logo, for $139. I found one online for, IIRC, $115 delivered.
You do realize that the retail prices are set by the manufacturer's importer and parts distributor, don't you?
The dealer can discount (or mark up) the suggested retail price but most generally work from the list price in the manufacturer's parts list. And part of their dealer franchise agreement is that they buy their OEM replacement parts from the manufacturer's distribution center. That's the difference between OEM and aftermarket. And the battery pricing you experienced. (I also bought my replacement 950 KTM battery from the Honda dealer.). The manufacturers and distributors cover their warranty costs as well as make a good portion of their operating budget from parts sales.
Smart dealers would offer you the choice of OEM or aftermarket with the appropriate price differential. But there really isn't much incentive for that. If I get 40% mark up, I make twice as much on the OEM KTM battery for the same effort as the $115 aftermarket battery. And I have the manufacturer's warranty on that part.