Normally a person is required to obtain a visa in his or her country of nationality and therefore only Canadian citizen should be allowed to obtain a visa in Canada.
There is an exception to the rule, and it is when a person does not have a country of nationality for a particular reason or because the American embassy in the country where the person want to obtain a visa (Canada) accepts to process the application for the visa. Each Embassy has its own rules governing issuance of visas and the person must directly contact the embassy or American Consulate in Canada to ask about their requirements to issue a visa to a person not citizen of Canada.